Your Ad Here

Wednesday, October 15, 2008

Defining Objects

The first statement in main(),

small obj s1, s2;

defines two objects, s1 and s2, of class small obj. Remember that the declaration for the class small obj does not create any objects. It only describes how they will look when they are created, just as a structure declaration describes how a structure will look but doesn’t create any structure variables. It is the definition that actually creates objects that can be used by the program. Defining an object is similar to defining a variable of any data type: Space is set aside for it in memory

No comments: