Skip to content

Instantly share code, notes, and snippets.

@jitpaul
Created May 5, 2018 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jitpaul/5247e08170cacbe6fd7e9a9c2821089e to your computer and use it in GitHub Desktop.
Save jitpaul/5247e08170cacbe6fd7e9a9c2821089e to your computer and use it in GitHub Desktop.
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