Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A
- {
- private:
- int n;
- public:
- A(); A(int a); void f(); void g();
- int h() const; void k() const;
- };
- A::A() {n = 0;} A::A(int a) {n = a;}
- void A::f() {n++;} void A::g() {f(); n = 2*n; f();}
- int A::h() const {return n;}
- void A::k() const {cout << n << endl;}
- int main()
- {
- A a; A b(2); A c; A d(3);
- a.f(); b.g(); c.f(); d.g(); d.k();
- A e(a.h() + b.h() + c.h()); e.k();
- return 0;
- } // end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement