/////////interface
//appication.h
#ifndef APPLICATION_MAIN_H
#define APPLICATION_MAIN_H
#include<string>
using std::string;
class appliance
{
protected:
string Manufacturer;
string Type;
public:
appliance(string a,string b);
~appliance();
void setManufacturer(string a);
string getManufacturer();
void setType(string b);
string getType();
void showDetails();
};
#endif
///////implementation////////////////////
//appication.cpp
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
#include<string>
using std::string;
#include "appication.h"
appliance::appliance(string a,string b)
{
Manufacturer=a;
Type=b;
}
appliance::~appliance()
{
cout<<"destructor"<<endl;
}
void appliance::setManufacturer(string a)
{
Manufacturer=a;
}
string appliance::getManufacturer()
{
return Manufacturer;//destructor
}
void appliance::setType(string b)
{
Type=b;
}
string appliance::getType()
{
return Type;
}
void appliance::showDetails()
{
cout<<Manufacturer<<endl;
cout<<Type<<endl;
}
///////////derive class//////////
//application.h
#ifndef APPLICATION_MAIN_H
#define APPLICATION_MAIN_H
#include<string>
using std::string;
#include<iostream>
using std::cin;
using std::endl;
using std::cout;
#include "appication.h"
class television:public application
{
protected:
int ScreenSize;
int LoadSizeRation;
public:
television(string a,string b, int c, int d);
~television();
void setScreenSize(int c);
int getScreenSize();
void setLoadSize(int d);
int getLoadSize();
void showDetails() const;
};
#endif
//////derive class implementation
//application_tel.cpp
#include<iostream>
using std::endl;
using std::cout;
using std::cin;
#include<string>
using std::string;
#include "application_tel.h"
television::television(string a,string b,int c, int d)
: appliance(a,b)
{
ScreenSize(c);//(a>=1.0) ? 1.0:(c);//baseSalary = ( salary < 0.0 ) ? 0.0 : salary;
LoadSizeRation(d);
}
television::~television()
{
cout<<"destructor"<<endl;
}
void television::setScreenSize(int c)
{
ScreenSize=c;
}
int television::getScreenSize()
{
return ScreenSize;
}
void television::setLoadSize(int d)
{
LoadSizeRation=d;
}
int television::getLoadSize()
{
return LoadSizeRation;
}
void television::showDetails()
{
cout<<"the screen size is"<<ScreenSize<<endl;
cout<<"the load is"<<LoadSizeRation<<endl;
}
///////////////main function///////////////
///application_main
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
#include<string>
using std::string;
#include "application_tel.h"
void main()
{
television tv1("Song","Tel",15,2);
}