Advertisement
TwITe

Untitled

Jan 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class A {
  5. private:
  6.     int& b;
  7. public:
  8.     A(int& arg): b(arg) {
  9.         cout << "Class A Object created" << endl;
  10.     }
  11. };
  12.  
  13.  
  14. class B {
  15. private:
  16.     int b;
  17. public:
  18.     B(int& arg): b(arg) {
  19.         cout << "Class B Object created" << endl;
  20.     }
  21. };
  22.  
  23. class C {
  24. private:
  25.     int b;
  26. public:
  27.     C(int arg): b(arg) {
  28.         cout << "Class C Object created" << endl;
  29.     }
  30. };
  31.  
  32. void test() {
  33.     int arg = 5;
  34.     A a(arg);
  35.     B b(arg);
  36.     C c(arg);
  37. }
  38.  
  39. int main() {
  40.     test();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement