Created
April 10, 2017 17:54
-
-
Save tornikegomareli/74b87918e693f65207bc8d975c2f70ec to your computer and use it in GitHub Desktop.
Student and Facultys Class inheritance Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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