Concept explainers
Examine the following classes. The table lists the variables that are members of the Third class (some are inherited). Complete the table by filling in the access specification each member will have in the Third class. Write “inaccessible if a member is inaccessible to the Third class.
class First
{
private:
int a;
protected:
double b;
public:
long c;
};
class Second : protected First
{
private:
int d;
protected:
double e;
public:
long f;
};
class Third : public Second
{
private:
int g;
protected:
double h;
public:
long i;
};
Member Variable | Access Specification in Third Class |
a | |
b | |
c | |
d | |
e | |
f | |
g | |
h | |
i |
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out With Visual Basic (8th Edition)
SURVEY OF OPERATING SYSTEMS
Concepts Of Programming Languages
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
- 3. Person and Customer Classes The Person and Customer Classes Write a class named Person with data attributes for a person’s name, address, and telephone number. Next, write a class named Customer that is a subclass of the Person class. The Customer class should have a data attribute for a customer number, and a Boolean data attribute indicating whether the customer wishes to be on a mailing list. Demonstrate an instance of the Customer class in a simple program.arrow_forward1. Employee and ProductionWorker Classes Write an Employee class that keeps data attributes for the following pieces of information: Employee name Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: Shift number (an integer, such as 1, 2, or 3) Hourly pay rate The workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for each class. Once you have written the classes, write a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen. 2. ShiftSupervisor Class In a…arrow_forwardWhat precisely are "static members" in a class? When and how may you use them to your advantage?arrow_forward
- The properties of a child class are inherited by the parent class. Select one: True Falsearrow_forwardIf a class is derived privately from the parent class then . Select one: a.all members are accessible by the child class b.no members of the base class is inherited c.all the members are inherited by the child class but are inaccessible d.the compiler gives an errorarrow_forwardemployee and production worker classes write an employee class that keeps data attributes for the following pieces of information: • employee name • employee number next, write a class named productionworker that is a subclass of the employee class. the productionworker class should keep data attributes for the following information: • shift number (an integer, such as 1, 2, or 3) • hourly pay rate the workday is divided into two shifts: day and night. the shift attribute will hold an integer value representing the shift that the employee works. the day shift is shift 1 and the night shift is shift 2. write the appropriate accessor and mutator methods for each class. once you have written the classes, write a program that creates an object of the productionworker class and prompts the user to enter data for each of the object’s data attributes. store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen. satak overfallowarrow_forward
- What is the difference between a class's static data member and a non-static data member?Give an example of why a static data member would be useful in the real world.arrow_forwardExplain the difference between the private and protected members of a class.arrow_forwardThere are two types of data members in a class: static and non-static. Provide an example of when it might be useful to have a static data member in the actual world.arrow_forward
- Write the first line of the definition for a Poodle class. The class should be derived from the Dog class.arrow_forwardComplete the following table by filling in private, protected, public, or inaccessible in the right-hand column: In a private base class, this base class MEMBER access specification... ..becomes this access specification in the derived class. private protected publicarrow_forwardIf a class is derived privately from the parent class then . Select one: a.the compiler gives an error b.all the members are inherited by the child class but are inaccessible c.no members of the base class is inherited d.all members are accessible by the child classarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning