Skip to content

Instantly share code, notes, and snippets.

@tornikegomareli
Created April 10, 2017 17:54
Show Gist options
  • Save tornikegomareli/74b87918e693f65207bc8d975c2f70ec to your computer and use it in GitHub Desktop.
Save tornikegomareli/74b87918e693f65207bc8d975c2f70ec to your computer and use it in GitHub Desktop.
Student and Facultys Class inheritance Implementation
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <string>
using namespace std;
class Student
{
private:
string Name;
string LastName;
bool Gender;
string PrivateNumber;
string MobileNumber;
public:
Student() {}
Student(string Name,
string LastName,
bool Gender,
string PrivateNumber,
string MobileNumber
)
{
this->Name = Name;
this->LastName = LastName;
this->Gender = Gender;
this->PrivateNumber = PrivateNumber;
this->MobileNumber = MobileNumber;
}
void Print()
{
cout << " Students Name : " << Name << endl;
cout << " Students LastName : " << LastName << endl;
if (Gender)
cout << " Students Gender is Male " << endl;
else
cout << " Students Gender is Female " << endl;
cout << " Students PrivateNumber : " << PrivateNumber << endl;
cout << " Students MobileNumber : " << MobileNumber << endl;
}
};
class Mathematics : public Student
{
private:
int Score;
public:
Mathematics() {}
Mathematics(string Name,
string LastName,
bool Gender,
string PrivateNumber,
string MobileNumber,
int Score
) : Student(Name,
LastName,
Gender,
PrivateNumber,
MobileNumber)
{
this->Score = Score;
}
};
class Physics : public Student
{
private:
int Score;
public:
Physics() {}
Physics(string Name,
string LastName,
bool Gender,
string PrivateNumber,
string MobileNumber,
int Score
) : Student(Name,
LastName,
Gender,
PrivateNumber,
MobileNumber)
{
this->Score = Score;
}
};
int main()
{
Mathematics Tornike("Tornike", "Gomareli", true, "010230", "568447779", 50);
Physics Giorgi("Giorgi", "Burdiladze", true, "0101", "56898459", 100);
Tornike.Print();
cout << "\n";
Giorgi.Print();
cin.get();
cin.get();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment