Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //Base class
- class Person
- {
- protected:
- double sum;
- };
- class Employee : protected Person {
- public:
- void Add(double input)
- {
- sum += input;
- cout << "The sum after adding is " << sum << endl;
- }
- void Substract(double input)
- {
- sum -= input;
- cout << "The sum after substracting is " << sum << endl;
- }
- };
- int main()
- {
- Employee Empl;
- Empl.Add(12);
- Empl.Substract(10);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement