Hello everyone,i have a simple problem which i canot understant.Here is a simple code which has a simple class ,i create an object of this class and then i call the function of this object and it runs just fine:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include<iostream>
usingnamespace std;
class one
{
public:
one(){}
void show(){cout<<"i am one \n";};
private:
};
int main()
{
one ena;
ena.show();
return 0;
}
and i try to execute ,my compiler returns me "class one __cdecl ena(void)"
Can you please explain me why this is hapening? An overloaded constructor can be declared like <<one ena(5,6);>> but the default constructor not.Why is that? Thanks !
one ena(); is the prototype for a function called 'ena' which takes no arguments and returns an object of type 'one'.
To call the default constructor, avoid the parentheses