Answer to Question #186163 in C++ for steve

Question #186163

Develop a code for the multiple inheritance diagram given below

·    The publisher base class consisting of data members such as pname and place, and member functions get() and display().

·    The author base class consisting of data members such as aname, and member functions get() and display().

·      The book derived class inherits the two base class publisher and author consisting of data members such as title, price and pages, and member functions get() and display().


1
Expert's answer
2021-04-27T07:16:07-0400
#include<iostream>
using namespace std;

class publisher{
  public:
    String pname;
    String place;
    get(){
      cout<<"method to get the value "<<endl;
}
    display(){
      cout<<"method to display the value "<<endl;
}
};
class author{
  public:
    String aname;
    get(){
      cout<<"method to get the value "<<endl;
}
    display(){
      cout<<"method to display the value "<<endl;
}
};
class book: public publisher, public author{
  public:
  String title;
  int price;
  int pages;
  get(){
      cout<<"method to get the value "<<endl;
}
  display(){
      cout<<"method to display the value "<<endl;
}
};
int main(){
book obj;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS