C Chapter 11 Inheritance 6 Consider Following Statements Class Fruits Food Declaration C Q37127913

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

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.