Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class PunktXY
- {
- public:
- int x;
- int y;
- PunktXY(int x, int y)
- {
- this->x=x;
- this->y=y;
- }
- void wyswietl()
- {
- cout<<"X: "<<x<<endl;
- cout<<"Y: "<<y<<endl;
- }
- };
- class PunktZ:public PunktXY
- {
- public:
- int z;
- PunktZ(int x, int y, int z)
- :PunktXY(x,y)
- {
- this->z=z;
- }
- void wyswietlz()
- {
- cout<<"Z = "<<z<<endl;
- }
- };
- int main() {
- PunktZ punkt(10,20,30);
- punkt.wyswietl();
- punkt.wyswietlz();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement