[prog] C++ object creation
ed orphan
millward at Ms.UManitoba.CA
Tue May 27 15:57:00 EST 2003
There seems to be two ways to create
an object with C++.
One is by using the new command along
with a pointer:
MyClass * MyClassPointer = new MyClass;
and the other is much simpler:
MyClass MyClassObject;
I know that the method using new creates
dynamically allocated memory for the object.
So, when you do not use new, what kind
of memory ( if any ) is used?
I like using MyClass MyClassObject
because its simple and short.
What's the advantage of using new to
create a new object? Is using new necsessary
for certain situations, or is it just another way
to do the same thing?.
Any information would be most welcome.
More information about the Programming
mailing list