82: (obj3.*PMF)();
83: cout << “Static: “ << myClass::GetStatic() << endl;
84:
85: return 0;
86: }
Day 16
Quiz
- Anis-arelationship is established with public inheritance.
- A has-arelationship is established with aggregation (containment); that is, one
class has a member that is an object of another type. - Aggregation describes the idea of one class having a data member that is an object
of another type. Delegation expresses the idea that one class uses another class to
accomplish a task or goal. - Delegation expresses the idea that one class uses another class to accomplish a task
or goal. Implemented in terms ofexpresses the idea of inheriting implementation
from another class. - A friend function is a function declared to have access to the protected and private
members of your class. - A friend class is a class declared so that all of its member functions are friend
functions of your class. - No, friendship is not commutative.
- No, friendship is not inherited.
- No, friendship is not associative.
- A declaration for a friend function can appear anywhere within the class declara-
tion. It makes no difference whether you put the declaration within the public:,
protected:, or private:access areas.
Exercises
- The following is one possible answer:
class Animal:
{
private:
String itsName;
};
856 Appendix D
32 0672327112_app_d.qxd 11/19/04 12:30 PM Page 856