Calling contructor without parameter
By Hugo on Saturday, September 13 2008, 15:29 - C++ - Permalink
Maybe something like that already happens to you : You wan't to build an instance of your class without calling the constructor :
class A { private: A(){}; ~A(){}; }; int main() { A a(); }
But this will compile on g++ without any problem... why is that ? Because you're not building an instance of your class, your declaring a function called "a", which will return an instance of A. If you pass parameters, g++ will understand this a a constructor call, but if you wan't to call a 0 parameter constructor, you will have to call your CTOR without parenthesis...