#include<iostream>
using namespace std;
class InsurancePolicy
{
private:
int policyNr;
string policyHolder;
double annualRate;
public:
InsurancePolicy(){
}
InsurancePolicy(int pNr, string pHolder, double aRate){
policyNr = pNr;
policyHolder = pHolder;
annualRate = aRate;
}
~InsurancePolicy();
void setPolicy(int pNr, string pHolder, double aRate){
policyNr = pNr;
policyHolder = pHolder;
annualRate = aRate;
}
int get_pNr()const{
return policyNr;
}
string get_pHolder()const{
return policyHolder;
}
double get_aRate()const{
return annualRate;
}
};
class CarInsurance: public InsurancePolicy{
private:
string excess;
public:
void set_excess(string ex){
excess = ex;
}
string get_excess(){
return excess;
}
};
InsurancePolicy:: ~InsurancePolicy(void){
cout<<"Object is being deleted."<<endl;
}
int main(){
CarInsurance insurance;
insurance.setPolicy(101,"Abraham",19992);
cout<<"Number is\t"<<insurance.get_pNr()<<endl;
cout<<"Holder is\t"<<insurance.get_pHolder()<<endl;
cout<<"Annul rate is\t"<<insurance.get_aRate()<<endl;
}
Comments
Leave a comment