Sorry if it a trivial question:
Implementation 1:
class Foo
{
protected: int bar;
public: Foo(int bar)
{
this->bar =bar;
}
};
Implementation 2:
class Foo
{
protected: int bar;
public: Foo(int bar)
{
this.bar =bar;
}
};
Output from implementation 2:
request for member ‘x’ in ‘this’, which is of pointer type ‘Foo* const’ (maybe you meant to use ‘->’ ?)
so this
is a pointer, and this question has syntax error in code