분류 전체보기

    2013.11.25 _ 연산자 오버로딩 연습 _

    연산자 오버로딩 : 연산자 오버로딩은 객체를 대상으로 산술연산, 관계연산, 논리연산을 재정의 하는 것이다. 함수반환형 operator 연산자(연산대상); 연산자 오버로딩 ( = , + ) #include #include using namespace std; class MYSTRING { public: // 디폴트 생성자 MYSTRING() { cpString = 0; uiLen = 0; } // 복사생성자 MYSTRING(MYSTRING &r) { // 디폴트 생성자에서 받은 값을 다시 넣어줌 uiLen = r.uiLen; // 클래스 안에 변수 cpString 에 동적할당 cpString = new char[uiLen+1]; memcpy(cpString, r.cpString , uiLen+1); cout

    2013.11.22 _ 연산자 오버로딩 _

    리턴타입 Class::operator 연산자(인수 목록){ 함수 본체;} 연산자 오버로딩 예제 #include using namespace std; class A { public: int iNum; // 디폴트 생성자 A() { iNum = 0; cout

    2013.11.21 _ 상속에서 멤버 함수 재정의(함수오버로딩,함수오버라이딩)

    함수 오버로딩 : 함수 이름은 같으나 함수의 매개변수는 다르게 정의하는 것 함수오버로딩 예제 // 함수 오버로딩 #include using namespace std; class TwoNumber { public: TwoNumber(); int AddNumber(const int ia, const int ib); double AddNumber(const double da, const double db); private: int i_sum; double d_sum; }; TwoNumber::TwoNumber() { i_sum = 0; d_sum = 0; } int TwoNumber::AddNumber(const int ia, const int ib) { i_sum = ia + ib; return i_sum;..

    2013.11.20 _ 상속 예제 연습

    ● 기반클래스와 파생클래스의 생성자와 호출자 생성자():(const)내부변수초기화 // const(상수) 값을 초기화 시켜줄수 있다.{변수정의} 상속 예제 소스 #include using namespace std; class smart { public: const int A; const int B; smart() :A(100),B(200) // int A = 100 , int A(100) 같은 문법 { cout

    2013.11.14_ 상속(Inheritance) _ 예제 실습

    상속 : 부모클래스 - 자식클래스가 존재한다. 부모클래스의 멤버 변수/함수를 그대로 가져와서(상속) 자식클래스에서 사용가능하다. class 파생클래스(자식클래스) : 접근지정자( public / private / protected ) 기반클래스(부모클래스,기저클래스){ 멤버함수와 멤버변수 선언;}; ※ 값의 접근(접근지정자) 접근지정자 자기자신(기반클래스)에서 파생클래스에서(자식클래스) 외부에서(main,...) public 참조가능 참조가능 참조가능 protected 참조가능 참조가능 참조불가능 private 참조가능 참조불가능 참조불가능 상속 예제 #include #include using namespace std; class Car { public: string Color; string Vendor..

    2013.11.11 _ 영상처리/RFID_시리얼통신 소스

    보호되어 있는 글입니다.