Complete the program Elass Person public: string profession; int age; Person (): profession("unemployed"), age(16) { } void display () { cout « "My profession is: « profession <« endl; cout << "My age is: <« age <« endl; walk(); talk(); void walk() { cout << "I can walk."« endl; } void talk(){ cout << "I can talk." « endl; }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question
Create game characters using the concept of inheritance.
Complete the program
class Person
{
public:
string profession;
int age;
Person (): profession("unemployed"), age(16) { }
void display ()
cout << "My profession is:
« profession << endl;
cout << "My age is:
<« age << endl;
walk();
talk();
void walk() { cout << "I can walk." << endl; }
void talk(){ cou << "I can talk." << endl; }
class MathsTeacher
class Footbailer
Transcribed Image Text:Create game characters using the concept of inheritance. Complete the program class Person { public: string profession; int age; Person (): profession("unemployed"), age(16) { } void display () cout << "My profession is: « profession << endl; cout << "My age is: <« age << endl; walk(); talk(); void walk() { cout << "I can walk." << endl; } void talk(){ cou << "I can talk." << endl; } class MathsTeacher class Footbailer
« profession « endl;
« age << endl;
cout <« "My profession is:
cout <« "My age is:
walk();
talk();
void walk() { cout << "I can walk." <« endl; }
void talk() { cout << "I can talk." << endl; }
}3;
class MathsTeacher
);
class Footballer
int main()
return 0;
Transcribed Image Text:« profession « endl; « age << endl; cout <« "My profession is: cout <« "My age is: walk(); talk(); void walk() { cout << "I can walk." <« endl; } void talk() { cout << "I can talk." << endl; } }3; class MathsTeacher ); class Footballer int main() return 0;
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr