Proper Types
- A type is called proper under any of these circumstances:
- It is a native type.
- It is a class with constructor, destructor,
copy constructor, and assignment operator that manage the type as if it were a
native type.
- It is a user defined type (class) whose variables
are proper types.
- Client programs can use the type exactly as if it were a native type
{
IntArray a; // IntArray with default number of elements
IntArray b(100); // IntArray with 100 elements
IntArray c(100,-1); // IntArray with 100 elements each initialized to -1
...
b = a;
...
a = b = c;
...
}
// destructor for each object a, b, c is called as they go out of scope
// order of destruction is reverse of order of declaration
|