Native/C++

생성자(Constructor)

aucd29 2013. 10. 2. 18:57
[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]