미안해 경우 사소한 질문 :대한 설명
구현 1 :
class Foo
{
protected: int bar;
public: Foo(int bar)
{
this->bar =bar;
}
};
구현 2 :
request for member ‘x’ in ‘this’, which is of pointer type ‘Foo* const’ (maybe you meant to use ‘->’ ?)
: 구현 2에서
class Foo
{
protected: int bar;
public: Foo(int bar)
{
this.bar =bar;
}
};
출력
그래서 this
은 포인터이고 this 질문에 문법 오류가 있습니다.
이것은 근본적인 것입니다. - (원시) 포인터는'-'만 사용할 수 있고'.'는 사용할 수 없습니다. –
FYI -'C++'&'C#'는 2 개의 다른 언어입니다. – user93353
자바에서 왔습니다. 번역에서 잃어버린 부분이 있습니다. @ user93353 코드에 C++ && C# 태그가 지정되어 있습니다. – aiao