본문 바로가기

Native/C++

생성자(Constructor)

[code]#include <iostream.h>
#include <conio.h>

class Position
{
public:
    int x;
    int y;
    char ch;

    Position(int ax, int ay, char ach)
    {
        x = ax;
        y = ay;
        ch = ach;
    }

    void OutPosition()
    {
        putch(ch);
    }
};

void main()
{
    Position Here(30,10,'A');
    Here.OutPosition();
}
[/code]

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

파괴자(Destructor)  (0) 2013.10.02
생성자 오버로딩(ConstructOverload)  (0) 2013.10.02
Date And People  (0) 2013.10.02
lotto KeyGen  (0) 2013.10.02
첫 페이지 으흐흐  (0) 2013.10.02