== 오늘 한 것 == * 함수, 연산자의 오버로딩 * friend 함수를 위해서는 VS 6.0 sp 5를 깔아야 한다.[http://download.microsoft.com/download/vstudio60ent/SP5/Wideband-Full/WIN98Me/KO/vs6sp5.exe] * Visual Assist[http://www.wholetomato.com/downloads/index.shtml] == vector 소스 == {{{~cpp #include using namespace std; class CVector { private: int x; int y; public: CVector(); CVector(int a, int b); CVector operator+(CVector a); void SetValue(int a, int b); int GetX(); int GetY(); }; ostream & operator<<(ostream &os, CVector &a); CVector::CVector() { x = 0; y = 0; } CVector::CVector(int a, int b) { x = a; y = b; } CVector CVector::operator+(CVector a) { CVector temp; temp.SetValue(x + a.GetX(), y + a.GetY()); return temp; } void CVector::SetValue(int a, int b) { x = a; y = b; } int CVector::GetX() { return x; } int CVector::GetY() { return y; } ostream & operator<<(ostream & os, CVector &a) { os << "x: " << a.GetX() << " y: " << a.GetY() << endl; return os; } int main() { CVector v1(50, 100); CVector v2(22, 33); CVector v3 = v1.operator +(v2); cout << "--v1값--" << endl; cout << v1 << endl; cout << "--v2값--" << endl; cout << v2 << endl; cout << "--v3값--" << endl; cout << v3 << endl; return 0; } }}} == 소감 == ---- [삼총사CppStudy]