Resolved Create objects without a constructor

aaaron123@roadrunner.com

Well-known member
Joined
Jan 23, 2011
Messages
47
Programming Experience
10+
Looking at a recent post I noticed that a Process object seems to be used (created) without calling a constructor.

Thinking about it I realized I've been doing the same things with Strings.

That is, creating an object (pointed to by a reference variable) by simply assignment.

I've been searching the internet using terms like "no constructor" but get no relevant hits.

I understand composing a complete tutorial relative to the above is most likely more time consuming than I have the right to expect, but I'm hoping for a few words that might simply help me understand and point me so I can better investigate on my own.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,439
Location
Norway
Programming Experience
10+
It is not possible to create an instance without using the New keyword to invoke the constructor. A method can create an instance and return that to you. It is also possible with conversion operators that create an instance from a different type of object.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,439
Location
Norway
Programming Experience
10+
Top Bottom