#include<iostream>
using namespace std;
class InsurancePolicy
{
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;
}
private:
int policyNr;
string policyHolder;
double annualRate;
};
InsurancePolicy:: ~InsurancePolicy(void){
cout<<"Object is being deleted. -Demostrating the calling of the destructor"<<endl;
}
int main(){
InsurancePolicy policy(1, "John", 12300);
cout<<"The policy number is\t"<<policy.get_pNr()<<endl;
cout<<"The policy holder is\t"<<policy.get_pHolder()<<endl;
cout<<"The policy annul rate is\t"<<policy.get_aRate()<<endl;
}
Comments
Leave a comment