SHARE
TWEET

Untitled

a guest Dec 9th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class PunktXY
  6. {
  7.     public:
  8.     int x;
  9.     int y;
  10.    
  11.    
  12.     PunktXY(int x, int y)
  13.     {
  14.         this->x=x;
  15.         this->y=y;
  16.     }
  17.    
  18.    
  19.    
  20.     void wyswietl()
  21.     {
  22.         cout<<"X: "<<x<<endl;
  23.         cout<<"Y: "<<y<<endl;
  24.     }
  25.    
  26.        
  27. };
  28.  
  29. class PunktZ:public PunktXY
  30. {
  31.     public:
  32.     int z;
  33.    
  34.     PunktZ(int x, int y, int z)
  35.     :PunktXY(x,y)
  36.     {
  37.         this->z=z;
  38.     }
  39.    
  40.     void wyswietlz()
  41.     {
  42.         cout<<"Z = "<<z<<endl;
  43.     }
  44.    
  45. };
  46.  
  47.  
  48.  
  49.  
  50. int main() {
  51.    
  52.     PunktZ punkt(10,20,30);
  53.     punkt.wyswietl();
  54.     punkt.wyswietlz();
  55.    
  56.     return 0;
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top