Const Member변수 초기화 특성
Computer/IT/C++ 2006/04/24 11:20 |- #include <iostream>
- using namespace std;
- class Student
- {
- const int id;
- int age;
- char name[20];
- public :
- Student(int _id, int _age, char *_name) : id(_id)
- {
- age = _age;
- strcpy(name,_name);
- }
- void Show()
- {
- cout << " " << id << endl;
- cout << " " << age << endl;
- cout << " " << name << endl;
- }
- };
- int main()
- {
- Student st(2002, 20,"good");
- st.Show();
- return 0;
- }
'Computer/IT > C++' 카테고리의 다른 글
| [VC] MMX support 여부 (0) | 2006/08/14 |
|---|---|
| Example Program: A Simple Query (0) | 2006/08/07 |
| Const Member변수 초기화 특성 (0) | 2006/04/24 |
| LinkedList 자료 (0) | 2006/04/06 |
| VC++ 단축키 모음 (2) | 2006/03/19 |
| Console - 바둑소스 (0) | 2006/02/22 |

댓글을 달아 주세요