Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- class A {
- private:
- int& b;
- public:
- A(int& arg): b(arg) {
- cout << "Class A Object created" << endl;
- }
- };
- class B {
- private:
- int b;
- public:
- B(int& arg): b(arg) {
- cout << "Class B Object created" << endl;
- }
- };
- class C {
- private:
- int b;
- public:
- C(int arg): b(arg) {
- cout << "Class C Object created" << endl;
- }
- };
- void test() {
- int arg = 5;
- A a(arg);
- B b(arg);
- C c(arg);
- }
- int main() {
- test();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement