#ifndef STRUCTURE_H_INCLUDED
#define STRUCTURE_H_INCLUDED
#include <iostream>
#include <string.h>
using namespace std;
class Struct
{
char c;
int i = 0;
public:
Struct();
Struct(char _c);
~Struct();
};
Struct::Struct()
{
cout << "default structure" << i++ << "th" << endl;
}
Struct::Struct(char _c)
{
c = _c;
cout << "Structure of " << c << endl;
}
Struct::~Struct()
{
cout << "deStructure of " << c << endl;
}
void simple_function()
{
Struct m('m');
}
#endif
#include <iostream>
#include "marine.h"
#include "structure.h"
using namespace std;
int main()
{
cout << endl << "=============== Structure =================" << endl;
Struct s('s');
Struct k('k');
simple_function();
return 0;
}
=============== Structure ===============
Structure of s
Structure of k
Structure of m
deStructure of m
deStructure of k
deStructure of s
계속하려면 아무 키나 누르십시오 . . .
'컴퓨터과학[1-2] > knou_C++' 카테고리의 다른 글
BankingSystem _v_2.1 (0) | 2014.10.28 |
---|---|
C ++ 연습문제 풀이 4 -1 (0) | 2014.10.21 |
배열 포인터 활용 (0) | 2014.09.23 |
C ++연습문제 2-1 풀이 (0) | 2014.08.17 |
getline(), get() 을 이용한 cin 에서 행 단위 입력 (0) | 2014.08.17 |
댓글