Created
September 5, 2017 02:28
-
-
Save benoxoft/d3bab07393d30722235ec5e91f8f5d4d to your computer and use it in GitHub Desktop.
null created by benoxoft - https://repl.it/Kgxj/1
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 Widget { | |
public: | |
Widget(int i, bool b); // ctors not declaring | |
Widget(int i, double d); // std::initializer_list params | |
}; | |
Widget::Widget(int i, bool b) { | |
cout << "Constructeur #1" << endl; | |
cout << i << endl; | |
cout << b << endl; | |
} | |
Widget::Widget(int i, double d) { | |
cout << "Constructeur #2" << endl; | |
cout << i << endl; | |
cout << d << endl; | |
} | |
int main() { | |
Widget w1(10, true); // calls first ctor | |
Widget w2{10, true}; // also calls first ctor | |
Widget w3(10, 5.0); // calls second ctor | |
Widget w4{10, 5.0}; // also calls second ctor | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment