i. Consider the diagram given in Question no. 2(11). Can we come across diamond problem in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
include using namespace std define the maximum size define SIZE 50 define the class template template define the class class GeneralStack public decla... View the full answer
Related Book For
Business Statistics in Practice
ISBN: 978-0077404741
6th edition
Authors: Bruce Bowerman, Richard O'Connell
Posted Date:
Students also viewed these programming questions
-
Should other protected classes be recognized under the law? If so, which ones? What is it about these groups that calls for protected class status?
-
Public School Teacher Salaries, Class Size and Private School Markets: In exercise 14.10, we noted that private schools that charge tuition operate alongside public schools in U.S. cities. There is...
-
In this exercise we consider how to deal with class lengths that are unequal (and with open-ended classes) when setting up histograms. Often data are published in this form and we wish to construct a...
-
Wesley and Camilla (ages 90 and 88, respectively) live in an assisted care facility and for 2018 and 2019 received their support from the following sources: a. Which persons are eligible to treat...
-
The Irish complain that they never got a chance to make automobiles because the English, their major trading partner, are more experienced and therefore more efficient at it. Would-be Irish...
-
Explain the morgue functions that the county medical examiners office typically performs.
-
Why are depositary receipts useful?
-
Evaluating the Choice among Three Alternative Inventory Methods Based on Income and Cash Flow Effects Daniel Company uses a periodic inventory system. Data for 2012: beginning merchandise inventory...
-
9. The management of Tarantulagoodies is considering a reduction in the corporation's debt ratio. The following information is available: Debt Common Stock $13,000,000, kd=7%, tax-rate-21%...
-
Will Googles pay strategy work forever? Consider the evolution of Microsofts pay strategy as its growth slackened. Should Google prepare for a similar future? If so, when and what sort of actions...
-
Ron is back in your office this week for a regular update on the projects you have been working on. His comment this week is "You know, I've been going through cost centre classifications all week...
-
What is the initial velocity if the mass is 0.250kg and the spring PE is 0.16625J and the initial kinetic energy is 0.16625J and spring compression is 0.05m
-
Everything about an Accountant Tax Specialty You must determine what your expected or desired entry-level job will be upon graduation and typical salary ranges for that job title. There are many...
-
In a triangle, the side lengths are (a = 8), (b = 12), and the included angle is (60^\circ). Calculate the length of the third side using both the sine and cosine laws.
-
2. A sky diver jumps from a plane at an altitude of 20km, where the temperature is around -20 C. After an initial acceleration period (which you can ignore), they fall through the air at a constant...
-
Solve the quadratic equation (z^2 + 4z + 13 = 0) for complex roots. Express the solutions in the form (a + bi), where (a) and (b) are real numbers.
-
(1) WhatsApp Classwork for F23 BU4033-G15 C Post a new question chegg.com/study/qa/post BIXX = tx My folder For example: What is e=mc^2 Career H Submit only one question per post to get the fastest...
-
Select the correct answer for each of the following questions. 1. On December 31, 20X3, Saxe Corporation was merged into Poe Corporation. In the business combination, Poe issued 200,000 shares of its...
-
An Ohio university wishes to demonstrate that car ownership is detrimental to academic achievement. A random sample of 100 students who do not own cars had a mean grade point average (GPA) of 2.681...
-
In the movie Forrest Gump, the public school required an IQ of at least 80 for admittance. a. If IQ test scores are normally distributed with mean 100 and standard deviation 16, what percentage of...
-
Use Tables A.5. A.6, A.7, and A.8 to find the following Fa points: a. F.l0 with df1 = 4 numerator degrees of freedom and df2 = 7 denominator degrees of freedom. b. F.01 with df1 = 3 and df2 = 25. c....
-
A slurry of pure \(\mathrm{NaCl}\) crystals, \(\mathrm{NaCl}\) in solution, \(\mathrm{NaOH}\) in solution, and water is sent to a system of thickener(s) at a rate of \(100.0 \mathrm{~kg} /...
-
Repeat Example 14-2 except for a three-stage countercurrent system and unknown underflow product concentration. Example 14-2 We wish to treat 1000.0 kg/h (wet basis) of insoluble meal (D) that...
-
This problem looks at the trade-offs between purity measured by \(\mathrm{y}_{\mathrm{I}, \text { out }} / \mathrm{y}_{\text {sugar, out }}\) and sugar recovery in the liquid,...
Study smarter with the SolutionInn App