17-12-2010, 21:33
|
|
|
|
חבר מתאריך: 04.11.04
הודעות: 6,986
|
|
ד"א, זה התקמפל אצלי:
קוד:
#include <iostream>
#include <string>
using namespace std;
class Employee {
public:
Employee(){};
virtual ~Employee(){};
virtual void printEmployeeDetails() = 0;
virtual void printType() = 0;
virtual string getFirstName() = 0;
virtual string getLastName() = 0;
int getSalary() const;
void setSalary(int salary);
protected:
int salary;
};
class Worker: public Employee {
public:
Worker(string firstName, string lastName,int salary);
~Worker();
void printEmployeeDetails(){};
void printType(){};
string getFirstName(){return firstName;};
string getLastName(){return lastName;};
private:
string firstName;
string lastName;
string type;
};
Worker::Worker(string firstName, string lastName,int salary)
{
firstName=firstName;
lastName=lastName;
salary=salary;
}
Worker::~Worker() {}
int main() {
Worker a = Worker("james","bond", 24000);
return 0;
}
|