Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Employee {
- public:
- virtual double countup() = 0;
- };
- class Employee1 : public Employee {
- int salary;
- public:
- Employee1(int salary) {
- this->salary = salary;
- };
- virtual double countup() override { return salary; };
- };
- class Employee2 :public Employee {
- int wage;
- int hours;
- public:
- Employee2(int wage, int hours) {
- this->wage = wage;
- this->hours = hours;
- };
- virtual double countup() override {return hours * wage;};
- };
- int main(){
- setlocale(LC_ALL, "Russian");
- Employee1 e1(500);
- cout << e1.countup() << endl;
- Employee2 e2(2, 10);
- cout << e2.countup() << endl;
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement