December 2002
Intermediate to advanced
648 pages
19h 53m
English
We often have members of classes which are themselves classes. Thus we might have something like this.
class MyClass
{
protected:
ClassA aobject;
ClassB *pbobject;
}; In this kind of situation, we say that aobject is an embedded or instance ClassA member, while pbobject is a pointer-based or reference ClassB member. We often prefer to use pointer-based members because then the methods of these members can be called polymorphically. When we talk about Serialization, Chapter 30, we’ll see that there are some important issues relating to the difference between embedded and pointer-based members.
Generally you let primitive variables be instance members, and you let your object members be references. ...
Read now
Unlock full access