Consider the C++ program below, and identify the pieces of code that represent following concepts of OOP. Also, explain why your chosen code represents a specific concept?  1. Abstraction 2. Encapsulation 3. Polymorphism 4. Inheritance (Types?) 5. Abstract Class d. Consider the same program to identify the following concepts  1. Pure virtual function 2. Mode of inheritance 3. Dynamic Binding 4. Parent class constructor call 5. Access to Protected data members

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

Consider the C++ program below, and identify the pieces of code that represent following concepts of OOP. Also, explain why your chosen code represents a specific concept? 
1. Abstraction
2. Encapsulation
3. Polymorphism
4. Inheritance (Types?)
5. Abstract Class
d. Consider the same program to identify the following concepts 
1. Pure virtual function
2. Mode of inheritance
3. Dynamic Binding
4. Parent class constructor call
5. Access to Protected data members

class staff
private:
int code;
string rame;
protected:
int salery;
public:
Staff()
code-
nane
salery - e;
Staff(string ne,int ca)
code - ce;
nane - na;
salery - ;
Iat getcode()
return code;
string getvane()
return name;
virtual int getsalery()-e;
virtual void setsalery(int salery) e;
class officer : public Staff
private:
int grade;
public:
Officer (string ne, int co, int gr) : staff(ns,ce)
grade- g3;
int getsalery()
return salery;
void setsalery(int sal)
Couts"n setting officer salery =";
salery. sal;
Transcribed Image Text:class staff private: int code; string rame; protected: int salery; public: Staff() code- nane salery - e; Staff(string ne,int ca) code - ce; nane - na; salery - ; Iat getcode() return code; string getvane() return name; virtual int getsalery()-e; virtual void setsalery(int salery) e; class officer : public Staff private: int grade; public: Officer (string ne, int co, int gr) : staff(ns,ce) grade- g3; int getsalery() return salery; void setsalery(int sal) Couts"n setting officer salery ="; salery. sal;
class Teacher : publit Staff
private:
string subject;
int publication;
public:
Teacher(string ra, int ca,string sut, int pu) : Staff(ra,cec)
subject - sut;
publication = pu;
int getsalery()
return salery;
veid setsalery (int sal)
couts<"\n setting Teacher salery =";
salery- sal;
Transcribed Image Text:class Teacher : publit Staff private: string subject; int publication; public: Teacher(string ra, int ca,string sut, int pu) : Staff(ra,cec) subject - sut; publication = pu; int getsalery() return salery; veid setsalery (int sal) couts<"\n setting Teacher salery ="; salery- sal;
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Class
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT