I have a class called sample.
class sample
{
private:
int Age;
public:
sample() : Age() {}
sample(int age)
{
this->Age = age;
}
};
In main
int main()
{
sample* s = new sample();
s(21);
return 0;
}
I want to pass values to the parameterized constructor through pointer object but it's giving this error
expression preceding parentheses of apparent call must have (pointer-to-) function type