728x90
반응형



헤더파일에는 클래스의 선언을,


cpp 파일에는 클래스의 정의를 작성한다.



클래스의 선언은 멤버변수의 선언과 멤버함수의 원형을 포함하게 되고, 


클래스의 정의는 멤버함수의 구현부로 이루어져 있다. 



Test.h 소스코드

#ifdef __TEST_H__
#define __TEST_H__
class Test
{
  private:
    char ch[10];
    int test;

  public:
    void testing(char* ID, int number);
};

#endif



Test.cpp 소스코드 

#include<iostream>
#include<cstring>
#include "Test.h"
using namespace std;

void Test::testing(char* ID, int number)
{
  ~~~~
}




Main.cpp 소스코드 

#include<"Test.h>
int main(void)
{
  Test test;
  test.testing("test1234", 100);

  return 0;
}





참고자료 : https://scytalezz.tistory.com/37

728x90
반응형