friend ostream1 C++ operator+ 연산자 오버로드(operator overloading) ,friend ostream& operator / friend istream& operator (스트림) 1. operator overloading 객체간의 연산을 위한 기능연산자 오버로드(operator overloading) 이라고 한다. 경우 1) 인수가 한 개리턴 값의 형 operator 연산자(인수);Complex operator+(Complex c); //이항 연산자를 멤버 함수로 오버로드 연산결과 +연산자의 왼쪽변수 오른쪽 변수Complex Complex::operator+(Complex c); //코드{Complex com(0,0);com.real = real + c.real;com.imag = imag + c.imag;return com;} 경우 2) 인수가 두 개friend 리턴 값의 형 operator 연산자 (인수1, 인수2);friend Complex operator+ (int c1,.. 2019. 1. 16. 이전 1 다음