What does it mean?
Hello,
Is this default constructor?
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <iostream>
#include<string>
using namespace std;
class myclass
{
int x;
public:
myclass(int i)
{
x = i;
}
int getx()
{
return x;
}
};
int main()
{
myclass obj = 126; // Is this default constructor?
cout << obj.getx();
return 0;
}
|
Last edited on
Topic archived. No new replies allowed.