Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class A
- {
- int x, y, z;
- public:
- A()
- {
- this->x = 0;
- this->y = 0;
- this->z = 0;
- }
- A(int xx) : A()
- {
- this->x = xx;
- }
- A(int xx, int yy) : A(xx)
- {
- this->y = yy;
- }
- A(int xx, int yy, int zz) : A(xx, yy)
- {
- this->z = zz;
- }
- void show()
- {
- std::cout << "x: " << this->x << std::endl;
- std::cout << "y: " << this->y << std::endl;
- std::cout << "z: " << this->z << std::endl << std::endl;
- }
- };
- int main()
- {
- A test;
- test.show();
- A test2(1);
- test2.show();
- A test3(1, 2);
- test3.show();
- A test4(1, 2, 3);
- test4.show();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement