본문 바로가기

Native/C++

initEmbedded 포함된 객체 초기화

[code]#include <turboc.h>

class position
{
public:
    int x, y;
    position(int ax, int ay) { x=ax; y=ay; }
};

class some
{
public:
    position pos;
    // 입력 받은 x, y 값을 position object 인 pos에 입력하는 방법...
    some(int x, int y) : pos(x, y) {}
    void outValue() { printf("%d, %d\n", pos.x, pos.y); }
};

void main()
{
    some s(3, 4);
    s.outValue();
}[/code]

'Native > C++' 카테고리의 다른 글

데이터의 보호  (0) 2013.10.02
형변환 금지 explicit  (0) 2013.10.02
initReferenceMember 레퍼런스멤버 초기화  (0) 2013.10.02
initConstMember 상수 멤버 초기화  (0) 2013.10.02
copyConstructor 복사생성자  (0) 2013.10.02