C++
Chapter 11 inheritance.
#6. Consider the following statements:
class fruits: food
{
…..
};
a. In this declaration, which class is the base class and whichclass is the derived class?
b. What is the type of this inheritance?
#12. Explain the difference between overriding and overloading amember function of a base class in a derived calss.
#14. Consider the following class definitions:
class smart
{
public:
void print() const;
void set(int, int);
int sum();
smart();
smart(int, int);
private:
intx;
inty;
intsecret();
};
class superSmart: sublic smart
{
public:
voidprint() const;
void set(int, int, int);
intmanipulate();
superSmart(int, int, int);
private:
int z;
};
a. Which private members, if any, of smart are public members ofsuperSmart?
b. Which members, functions, and/or data of the class smart aredirectly accessible in class superSmart?
Solution
C++Chapter