QUESTION 1:
virtual void compute(){ n = n*n; } // LINE-1virtual void show(){ cout << n << endl; } // LINE-2
};
QUESTION 2:
Base::f(); // LINE-1 Call proper function
cout << name << endl;
}
void g() {
Base::g(); // LINE-2 Call proper function
}
};
void Base::f(){ // LINE-3 Write proper function header
cout << "Good day, ";
}
void Base::g(){ // LINE-4 Write proper function header
QUESTION 3:
virtual void computeSalary()=0; // LINE-1
double computePF(int basic) { return (basic*pf / 100); }
};
class Manager : public Employee {
int basic;
public:
Manager(int b) : basic(b) { }
void computeSalary() {
double pf = Employee::computePF(basic); // LINE-2
double sal = basic + pf;
cout << "Manager's Salary: " << sal << endl;
}
};
class Analyst : public Employee {
int basic;
public:
Analyst(int b) : basic(b) { }
void computeSalary() {
double pf = Employee::computePF(basic); // LINE-3
QUESTION 4:
virtual ~base() { print(); } // LINE-1
};
class derived : public base {
public:
derived(int _counter = 0) : base(++_counter) { cout << counter << " "; }
virtual ~derived(){ print(); } // LINE-2
};
Thank you
ReplyDelete