Coffeehouse Post

Single Post Permalink

View Thread: Visual Basic.Net Reference vs Instantiate
  • User profile image

    I've got a question about using objects in Visual Basic 2008.

    If I do this:

    Dim joe as Guy

    This is a reference. In order to use joe I must also do this:

    Dim joe as New Guy

    This does what's called instantiate the object. What is the difference? Why do I have to do both before I can use the object? Are there reasons why I would only do the reference and not follow it up with instantiate? What really is going on inside the computer when I do each step? When is memory actually allocated?

    Thanks. I'm new at object oriented programming. I am used to more procedural languages like COBOL.