class Abc
{
public:
void DoThis();
private:
void DoThat();
int alpha;
int beta;
};
class Xyz : public Abc
{
public:
void TryIt();
private:
int gamma;
};
For each class, do the following:
a. List all private data members.
b. List all private data members that the class's member functions can reference directly.
c. List all functions that the class's member functions can invoke.
d. List all member functions that a client of the class may legally invoke.
5. A class X uses both inheritance and composition as follows. X is derived from class Y and has a member that is an object of class Z. When an object of class X is created, in what order are the constructors for classes X, Y, and Z executed?
6. With parameter passage in C++, you can pass an object of an ancestor class to a formal parameter that is an object of a descendant class. (True or False?)
7. Consider the following two class declarations:
class A
{
public:
virtual void Write() const;
A( /* in */ char ch );
private:
char c;
};
class B : public A
{
public:
void Write() const;
B( /* in */ char ch1,
/* in */ char ch2 );
private:
char d;
};
Let the implementations of the constructors and Write functions be as follows: