Skip to content

Commit

Permalink
Create abstract_class.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mahakagarwal248 authored Oct 19, 2020
1 parent a131ffb commit 076178a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions c++/abstract_class.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@


// Write your MyBook class here

// Class Constructor
//
// Parameters:
// title - The book's title.
// author - The book's author.
// price - The book's price.
//
// Write your constructor here


// Function Name: display
// Print the title, author, and price in the specified format.
//
// Write your method here

// End class
class MyBook: public Book{
int price;
public:
MyBook(string title, string author, int p):Book(title, author)
{
price=p;
}
void display()
{
cout<<"Title: "<<title<<endl;
cout<<"Author: "<<author<<endl;
cout<<"Price: "<<price<<endl;
}
};

0 comments on commit 076178a

Please sign in to comment.