Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i have a c++ question Suppose that a class employeeType is derived from the class personType (see Example 10-10 in Chapter 10). Give examples of

i have a c++ question

Suppose that a class employeeType is derived from the class personType (see Example 10-10 in Chapter 10). Give examples of membersdata and functions that can be added to the class employeeType. Also write the definition of the class employeeType that you derived from the class personType, and the definitions of the member functions of this class.

Consider the class circleType as defined in Example 10-8 (Chapter 10). Suppose that the class sphereType is derived from the class circleType.

a. Name some of the functions and/or data members that can be added to the class sphereType. b. Write the definition of the class sphereType. c. Write the definitions of the member functions of theclasssphereType.

Example 10-10 in Chapter 10

#include using namespace std; class personType { public: void print() const; //Function to output the first name and last name //in the form firstName lastName. void setName(string first, string last); //Function to set firstName and lastName according //to the parameters. //Postcondition: firstName = first; lastName = last string getFirstName() const; //Function to return the first name. //Postcondition: The value of firstName is returned. string getLastName() const; //Function to return the last name. //Postcondition: The value of lastName is returned. personType(string first = "", string last = ""); //Constructor //Sets firstName and lastName according to the parameters. //The default values of the parameters are null strings. //Postcondition: firstName = first; lastName = last private: string firstName; //variable to store the first name string lastName; //variable to store the last name };

We now give the definitions of the member functions of the class personType void personType::print() const { cout << firstName << " " << lastName; } void personType::setName(string first, string last) { firstName = first; lastName = last; } string personType::getFirstName() const { return firstName; } string personType::getLastName() const { return lastName; } //constructor personType::personType(string first, string last) { firstName = first; lastName = last; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

Assessment of skills and interests.

Answered: 1 week ago

Question

Psychological, financial, and career counseling.

Answered: 1 week ago