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...
-
News.com is a Web site that offers users access to current national and international news stories. News.com does not charge users a fee for accessing the site, but rather charges advertisers $ 0.05...
-
The 1H NMR spectrum of bullvalene at 100 C consists only of a single peak at 4.22 ?. Explain. Bullvalene
-
. Identify five items that are adjustments to reconcile net income to net cash provided b\ operating activities under the indirect method
-
Explain why controls have to be tested for the entire fiscal year if they are to be relied on in the financial statement audit. Why do they only have to be tested related to their effectiveness at...
-
ABC Inc. is considering two projects, Project X and Project Y. Both projects have the following details: Project X: Initial Investment: $180,000 Cost of Capital: 8% Cash Inflows: Year 1: $60,000 Year...
-
You have recently started work as a management accountant at Zilber Hotels, reporting to the financial controller. Draft management accounts have been prepared for the year just finished, and the...
-
The following income statement and additional year-end information is provided. SONAD COMPANY Income Statement For Year Ended December 31 Sales $ 1,802,000 Cost of goods sold. 882,980 919,020 Gross...
-
Given, Financial indicators: gross insurance premiums and return on investment. Economic indicators: policies, practices, and expenditures on local suppliers, as well as procedures for recruiting...
-
If volume is measured by the number of students in an online class, would the operating leverage be high or low and please explain why? Normally we have 10 people in class but this term there are 3....
-
Sheridan Bucket runs a company, Yummy Green Drinks AB, that specializes in selling healthy drinks at a reasonable price. A six-pack of drinks (25 cl each bottle) is sold for 21 SEK. The supplier...
-
1. According to the EIA, how much did all the customers in the US pay for electricity in 2018, in billions of USD? 2 - According to the LLNL 2018 Sankey Diagram, how much natural gas was used by the...
-
XYZ Construction is considering two projects to develop. The expected cash inflows are as follows : Project M Project N Year 110,00025,000 Year 215,00025,000 Year 3 20,00025,000 Year 425,00025,000...
-
Modern Media wants to estimate its annual costs associated with clients. Assume costs for media supplies and staff are variable costs. Data from last year (100 clients): Media supplies: $19,000 Staff...
-
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....
-
United Limited, a company that manufactures sporting equipment and accessories, owns a number of properties, which are listed below: 1. Trafford Lane: a freehold factory and office block used...
-
Helix Limited (Helix) purchased three identical properties (Right, Left and Up), and leased a fourth (Down), which has been classified as a right-of-use asset in accordance with IFRS 16 Leases,...
-
What are the principal accounting and disclosure differences between IAS 40 and FRS 102, Section 16?
Study smarter with the SolutionInn App