Skip to content

Instantly share code, notes, and snippets.

@jitpaul
Created May 5, 2018
Embed
What would you like to do?
Constructor
#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