Reputation: 795
I just stumbled upon this piece of code:
class MyClass
{
public:MyClass();
void DoMagic();
private:
void DoRealMagic();
private:
int m_iSomething;
};
I wonder about this line:
public:MyClass();
What exactly does it mean and do?! I have never seen this before in C++ ... seems like it has something to do with the default ctor?!
Upvotes: 0
Views: 96
Reputation: 1
You can write as well
public:
MyClass();
to make it clearer.
It's just a public default constructor declaration. No magic, nothing special.
I have never seen this before in C++ ...
Yes, it's very unusual to write it as seen. Proper line breaks and indentations are making the code much clearer to read.
Upvotes: 5