-
-
Save TPAKC/a8cd956d2af9702c76df060fd530e437 to your computer and use it in GitHub Desktop.
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 <string> | |
#include <windows.h> | |
using namespace std; | |
class Class1 | |
{ | |
public: | |
double i; | |
double j; | |
Class1() | |
{ | |
cout<<"Введiть I:"; cin>>i; | |
cout<<"Введiть J:"; cin>>j; | |
} | |
}; | |
class Class2 | |
{ | |
protected: | |
int y; | |
private: | |
int x; | |
public: | |
void show_1() | |
{ | |
cout<<"X="<<x<<endl; | |
cout<<"Y="<<y<<endl; | |
} | |
Class2() | |
{ | |
cout<<"Введiть X:"; cin>>x; | |
cout<<"Введiть Y:"; cin>>y; | |
} | |
}; | |
class Class3 | |
{ | |
protected: | |
char a; | |
char b; | |
public: | |
Class3() | |
{ | |
cout<<"Введiть A:"; cin>>a; | |
cout<<"Введiть B:"; cin>>b; | |
} | |
void show_2() | |
{ | |
cout<<"A="<<a<<endl; | |
cout<<"B="<<b<<endl; | |
} | |
}; | |
class Class4 : private Class1, public Class2, protected Class3 | |
{ | |
public: | |
Class4() : Class1(),Class2(),Class3() | |
{} | |
void show_ij() | |
{ | |
cout<<"I="<<i<<endl; | |
cout<<"J="<<j<<endl; | |
} | |
}; | |
class Class5 : public Class4 | |
{ | |
public: | |
Class5 (): Class4() | |
{} | |
void show_all() | |
{ | |
show_ij(); | |
show_1(); | |
show_2(); | |
} | |
}; | |
int main() | |
{ | |
SetConsoleCP(1251); | |
SetConsoleOutputCP(1251); | |
setlocale(LC_ALL, ""); | |
Class5 objClass; | |
cout<<"show_1:"<<endl; | |
objClass.show_1(); | |
cout<<"show_2:"<<endl; | |
objClass.show_2(); | |
cout<<"show_ij:"<<endl; | |
objClass.show_ij(); | |
cout<<"show_all:"<<endl; | |
objClass.show_all(); | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment