previous
|
index
|
next
Class Constructors
When the
ItemInfo
class is defined as above, a special method called a
constructor
is defined behind the scenes.
A constructor's name is always the same as the class name.
A constructor can be used with the
new
operator to dynamically create a new instance (object) of a class:
ItemInfo* item = new ItemInfo;
// note the absence of arguments
previous
|
index
|
next