Thursday, July 30, 2009

[Cpp-Programming] doubt in c++

hi,

i'm pretty new to c++. i have got a simple doubt. please answer.

i have a class called square.

class square
{
//some implementation here
}

now when i write the main program i create the object. here is where
i'm confused. i feel i can create the object square in two ways. let
me know if i'm correct.

square obj_sqr1; // this is one way

square* ptr_square;
ptr_square = new square ; // using the new operator, forgive me if
the syntax is wrong

what is the difference between the two ? are they same ? ..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

<< Home