Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i. Consider the diagram given in Question no. 2(11). Can we come across diamond problem in this scenario? If yes, explain and suggest solution?
i. Consider the diagram given in Question no. 2(11). Can we come across diamond problem in this scenario? If yes, explain and suggest solution? If not, illustrate the reasons. How the Person class be made abstract? If Person class becomes abstract, what changes should be made in the other classes? (3) ii. Consider the following inheritance hierarchy: class A{ (4) 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) How many data members does B have? Write their names. b) How many of B's data members are visible in B? Write down their names. c) Which members of B are accessible in main()? How will they be accessed? d) If the protected Access specifier in A is changed to public, then how many members of B will be accessed in main() and how? e) Define the function set() without changing its signature as given above. ) Write a default constructor for the class B that does not have an empty parameter list. g) If the data members of A become private, then how they be initialized? h) Add a static data member in class B. Can we use this pointer with static members? If yes how? iii. Create a class template for a class named GeneralStackthat holds (3) A single data member as an array named stack of size 50 to store certain elements Three member functions i.e. push(type) to add elements in the Stack, pop() to remove elements from the stack, and currentStatus() to check whether the array is filled or not. (A filled array is an array that has non-zero value at all of its indexes). In the main() function, create three objects with different data types of class General Stack and test the functionality of member functions for various values of data members for these objects. Person Employee Student Administration Academic Dean/HOD A person can be an emplovee or a etudent An emplovee may have rights of admin officer or of
Step by Step Solution
★★★★★
3.34 Rating (160 Votes )
There are 3 Steps involved in it
Step: 1
include using namespace std define the maximum size define SIZE 50 define the class template template define the class class GeneralStack public decla...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started