일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- 노키아
- 프라하
- 어플
- Nell
- 타워브릿지
- 카를교
- 바티칸
- Amsterdam
- i-sms
- 베르사유 궁전
- free i-sms
- 루브르
- BMW Museum
- 통신이론
- Narita
- london
- 프라하성
- 익뮤
- 융프라우
- Jekyll & Hyde
- Interlaken
- Paris
- Zaanse Schans
- 5800
- 파리
- 나리타 공항
- N5800
- 프랑스
- BMW 박물관
- GMF2011
Archives
- Today
- Total
기억
Structure (2) 본문
3. Member function
ex1)
struct point{ double x,y; void print(){cout << "(" << x << "," << y << ")"; } void init(double u, double v) { x=u; y=v; } }; int main() { point w1, w2; w1.init(0, 0.5); w2.init(-0.5,1.5);
cout << "\npoint w1 = "; w1.print(); cout << "\npoint w2 = "; w2.print(); }
출력
point w1 = (0, 0.5)
point w2 = (-0.5, 1.5)
point 형태로 w1, w2를 선언하여 함수와 같이 사용.
ex2)
struct point{ ... void plus(point c); //function prototype ... }; void point::plus(point c) // definition not inline { x += c.x; y += c.y; }
함수를 선언만 해놓고 나중에 정의
Comments