G
Guest
I'm curious about the differeng behavior of the "new" keyword when dealing
with value versus object types. If I'm correct, when I do:
dim x as integer
There's no need for "new" to be called since this "value" type is all set to
go. Is this because value types are stored on the stack so the memory
initialization is already taken care of?
Now, when dealing with an object type, it seems you do need to use the "new"
keyword. Accordingly, when I do:
dim x as oledbconnection
What exactly is x before it's assigned to something with the "new" keyword?
Is it just space on the stack just as before?
Assuming this all to be the case, I'm curious about the behavior of the
String class. I was under the impression that it is not a value type.
However, it can be assigned to without using the new keyword, which breaks
the logic I thought applied. Further, it allows you to use the new keyword on
it.
Another question: What is the purpose of the "new" keyword on a value type?
Is it just for initialization (calling a constructor)? When "new" is called
on a object type, does it do this as well as return a pointer to the heap
address?
Thanks for any clarification...
-Ben
with value versus object types. If I'm correct, when I do:
dim x as integer
There's no need for "new" to be called since this "value" type is all set to
go. Is this because value types are stored on the stack so the memory
initialization is already taken care of?
Now, when dealing with an object type, it seems you do need to use the "new"
keyword. Accordingly, when I do:
dim x as oledbconnection
What exactly is x before it's assigned to something with the "new" keyword?
Is it just space on the stack just as before?
Assuming this all to be the case, I'm curious about the behavior of the
String class. I was under the impression that it is not a value type.
However, it can be assigned to without using the new keyword, which breaks
the logic I thought applied. Further, it allows you to use the new keyword on
it.
Another question: What is the purpose of the "new" keyword on a value type?
Is it just for initialization (calling a constructor)? When "new" is called
on a object type, does it do this as well as return a pointer to the heap
address?
Thanks for any clarification...
-Ben