# Include <string>
# Include <iostream>
Using namespace STD;
Class worker {
Public:
Int ID;
String name;
Worker (INT id1 = 0, string name1 = "", float salary1 = 0.0): ID (id1), name (name1), salary (salary1 ){}
Virtual void get_salary (int id)
{
Cout <salary <Endl;
}
Protected:
Float salary;
};
Class TEM: public worker {
Public:
TEM (INT id1 = 0, string name1 = "", float salary1 = 0.0, int level1 = 0): worker (id1, name1, salary1), level (level1 ){}
Void get_salary (int id) = 0;
Protected:
Int level;
};
Class worker_d: Public TEM {
Public:
Worker_d (INT id1 = 0, string name1 = "", float salary1 = 0.0, int level1 = 0): TEM (id1, name1, salary1, level1 ){}
Void get_salary (int id)
{
Cout <id <"<level <" "<salary;
}
};
# Include "worker. H"
Int main ()
{
Worker A (0, "Vivi", 3000 );
Worker_d B (1, "Cucu", 1 );
Tem c (2, "Cucu", 1 );
A. get_salary (0 );
B. get_salary (1 );
}
G ++-O main. cpp
Main. cpp: In function 'int main ()':
Main. cpp: 7: Error: cannot declare variable 'C' to be of abstract type 'tem'
Worker. h: 18: Note: because the following virtual functions are pure within 'tem ': // pure virtual function
Worker. h: 21: Note: Virtual void TEM: get_salary (INT)