Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Example program
- #include <iostream>
- #include <string>
- using namespace std;
- class D{
- public:
- D() {cout << "D0 ";}
- D(int a) {cout << "D1 ";}
- };
- class E{
- private:
- D d;
- public:
- E() : d(3) {cout << "E0 ";}
- E(double a, int b) {cout << "E2 ";}
- E(const E& a) : d(a.d) {cout << "Ec ";}
- };
- class C{
- private:
- int z;
- E e;
- D d;
- E* p;
- public:
- C() : p(0), e(), z(4) {cout << "C0 ";}
- C(int a, E b) : e(3.7, 2), p(&b), z(1), d(3) {cout << "C1 ";}
- C(char a, int b) : e(), d(2), p(&e) {cout << "C2 ";}
- };
- int main()
- {
- E e; cout << endl;
- C c; cout << endl;
- C c1(1, e); cout << endl;
- C c2('b', 2); cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement