Constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Example1 { | |
public: | |
Example1(int a) { cout << "Inside Example 1\n"; } | |
}; | |
class Example2{ | |
Example1 e1; | |
public: | |
Example2():e1(2) { cout << "Inside Example 2\n"; } | |
}; | |
int main() { | |
Example2 e2; | |
cin.get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment