Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Pont{
- private:
- int x,y;
- public:
- Pont(int nX, int nY): y(nY),x(nX){};
- void kiir(){
- cout << "x: " << this->x << " y:" << this->y<<"\n";
- cout << "\n";
- }
- int getX(){return x;}
- int getY(){return y;}
- void setX(int nX){this->x = nX;}
- void setY(int nY){this->y = nY;}
- };
- class Kor{
- private:
- int r;
- string tipus;
- Pont p;
- public:
- Kor(int nR, int x, int y): p(x,y){
- r=nR;
- };
- void kiir(){
- cout <<"Konstruktor: " << tipus;
- cout << "sugar: " << r;
- cout << "x koordinata: " << p.getX() <<" y koordinataja: " << p.getY();
- }
- };
- int main()
- {
- Kor k(1,2,3);
- k.kiir();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement