You are on page 1of 2

#include <iostream>

#include <string>

using namespace std;

class Test{
protected:
string name;
string subject;
int points;
public:
string getName()
{
return name;
}
void setName (string n)
{
name = n;
}
string getSubject()
{
return subject;
}
void setSubject (string s)
{
subject = s;
}
int getPoints()
{
return points;
}
void setPoints (int p)
{
points = p;
}
virtual void show()
{
cout<<"Test: "<<name<<" "<<subject<<" "<<points<<endl;
}
};
class Exam: public Test{
public:
void show()
{
cout<<"Exam: "<<name<<" "<<subject<<" "<<points<<endl;
}
};
class FinalExam: public Test{
public:
void show()
{
cout<<"Final Exam: "<<name<<" "<<subject<<" "<<points<<endl;
}
};
class Trial: public Test{
protected:
string company;
public:
void setCompany (string c)
{
company = c;
}
string getCompany()
{
return company;
}
void show()
{
cout<<"Trial: "<<name<<" "<<company<<" "<<points<<endl;
}
};

int main()
{
Test Test;
Test.setName("Dave");
Test.setSubject("Math");
Test.setPoints(88);
Test.show();

Exam Exam;
Exam.setName("John");
Exam.setSubject("Chemistry");
Exam.setPoints(90);
Exam.show();

FinalExam Final;
Final.setName("Abel");
Final.setSubject("Scientific work");
Final.setPoints(90);
Final.show();

Trial Trial;
Trial.setName("Bill");
Trial.setCompany ("BigCompany");
Trial.setPoints(97);
Trial.show();

return 0;
}

You might also like