#include<bits/stdc++.h>
using namespace std;
class A{
int x;
public:
A(){
x=10;
}
void show(){
cout<<x<<endl;
}
};
main(){
A a;
a.show();
}
In the main()
function when I am declaring the variable a
in the above way, the code works fine but if we declare the variable A a()
compiler gives error. Why is it so? I think there is no problem regarding argument type matching. Can anyone help?