<aside> 💡 목차


</aside>

<aside> 💡 C++ 연산자 종류


Untitled


Untitled

</aside>

전위연산, 후위연산

Untitled

Untitled

전위연산, 후위연산을 밑바닥 코드까지 뜯어보자!

[C++ 수식 종류] - 전위,후위 연산

증감 연산자 (전위,후위 연산)

밑바닥 코드를 보자
a = 5 일 경우

++a
a++

의 경우를 봅시다.
과연 '++' 함수는 어떻게 구현되어있을까요??

1. ++a 의 경우

int operator++(){
	this->value+=1;
	return this->value;
};

2. a++ 의 경우

int operator++(<u>***int***</u>){
	**int temp=this->value; //일단 this 값을 temp에 백업해둠**
	this->value+=1;
	return **temp; //temp를 반환함**
}