c++로 짜여진 코드에서 흔히 보는 세 연산자 "::" , "->", "." 의 차이
세 연산자 모두 멤버 함수나 변수에 접근하기 위해 사용된다.
그 차이는 접근하는 방법에 있다.
https://stackoverflow.com/questions/11902791/what-is-the-difference-between-and-in-c
(1) Dot operator is used in direct member selection scenarios.
c++로 짜여진 코드에서 흔히 보는 세 연산자 "::" , "->", "." 의 차이
세 연산자 모두 멤버 함수나 변수에 접근하기 위해 사용된다.
그 차이는 접근하는 방법에 있다.
https://stackoverflow.com/questions/11902791/what-is-the-difference-between-and-in-c
(1) Dot operator is used in direct member selection scenarios.
print(a.b)
Here, we are accessing b
, which is a direct member of an object a
. So, primarily, a
is an object and b
is a member (function/ variable etc) of a
.
즉 여기서 a 는 object
(2) Arrow operator is used in indirect member selection scenarios.
print(a->b)
Here, we are accessing b
which is a member of the object, that is pointed to by a
. It is shorthand of (*a).b
and so here, a
is primarily a pointer to an object and b
is a member of that object.
(3) Double Colon (Scope) operator is used in namespace related direct member selection scenarios.
print(a::b)
Here, we are accessing b
which is a member of the class/namespace a
.So, primarily, a
is a class/namespace and b
is a member (function/ variable etc) of a
.
즉, 이 경우 a 는 class/namespace.
얼마전 넷플릭스에서 선리기연을 오래간만에 다시 보았다. 이미 여러번 보았기 때문에, 예전과 같은 재미나 감동을 느끼지는 못했지만, 여전히 일생소애(一生所爱) 노래가 흘러나오는 부분에서는 아련함을 느낄 수 있었다. 노래의 가사를 잘 몰랐기 때문에 인터넷으로 한 번 찾아보았는데, 중국어를 하나도 모름에도 대강의 뜻을 파악할 수 있었다. 오히려 한국식 한자 음을 붙여보니, 신선한 재미가 있었기에, 여기에 적어본다. (한 번 한국식 한자음으로 노래를 불러보라. 색다를 것이다.)
인터넷에서 찾아본 바로는 가사의 한자가 조금 다른 경우가 있었다. 어느 쪽이 맞는지 모르므로, 그냥 한자와 해석을 나무 위키에 있는 것을 가져왔다.(중국어 해석이 맞는지 모름) 중국음은 역시 나무위키를 볼 것. 여기서는 각 한자를 풀어 보기만 하겠다.
從前現在過去再不來