Inheritace 9
Inheritace 9
Inheritace 9
Solution of Object-Oriented
Programming C++ Chapter # 9;
// ex9_1.cpp
// publication class and derived classes
#include <iostream>
#include <string>
using namespace std;
class publication // base class
{
private:
string title;
float price;
public:
void getdata()
{
cout << "\nEnter title: "; cin >> title;
cout << "Enter price: "; cin >> price;
}
void putdata() const
{
}
void putdata()
{
publication::putdata();
//P9.7
#include <iostream>
#include <conio.h>
using namespace std;
class Counter
{
protected: //NOTE: not private
unsigned int count; //count
public:
Counter() : count() //constructor, no args
{}
Counter(int c) : count(c) //constructor, one arg
{}
unsigned int get_count() const //return count
{