Consider the following inheritance hierarchy: class A{ protected: int x, y; public: int z; }; class B: private A{ private: int a, b, c; public: void set(int x, int y, int z, int a, int b, int c); };...


Consider the following inheritance hierarchy:


class A{ protected: int x, y; public: int z; };


class B: private A{ private: int a, b, c;


public: void set(int x, int y, int z, int a, int b, int c); };


Int main(){ Aobja; B objb; }



a) If the protected Access specifier in A is changed to public, then how many members of B will be accessed in main() and how?


b) Define the function set() without changing its signature as given above. c) Write a default constructor for the class B that does not have an empty parameter list.


d) If the data members of A become private, then how they be initialized? e) Add a static data member in class B. Can we use this pointer with static members? If yes how?



Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here