5. 헤더파일의 Include 제거
Player.h Player.cpp
헤더 파일의 Include는 적을 수록 좋다!!
• 컴파일 속도가 빨라진다. (Include는 파일의 내용을 삽입(!) 하는 것)
• 각 파일간의 의존도(커플링)을 제거 한다.
6.
7.
8. class Player
배 객체들을 가지고 있다
•Aircraft, Battleship, Cruiser, Destroyer(x2)
내 배들을 배치한다.
상대방의 공격에 피격 체크 결과를 알려준다.
맵 객체들을 가지고 있다.
상대방을 공격 한다.
9. class Player
배 객체들을 가지고 있다
•Aircraft, Battleship, Cruiser, Destroyer(x2)
내 배들을 배치한다.
상대방의 공격에 피격 체크 결과를 알려준다.
맵 객체들을 가지고 있다.
상대방을 공격 한다.
10. #pragma once
/// 게임을 진행하는 플레이어 클래스
class Player
{
public:
Player();
~Player();
};
#pragma once
#include "Aircraft.h"
#include "Battleship.h"
#include "Cruiser.h"
#include "Destroyer.h"
/// 게임을 진행하는 플레이어 클래스
class Player
{
public:
Player();
~Player();
protected:
// 배 객체들
Aircraft m_Aircraft;
Battleship m_Battleship;
Cruiser m_Cruiser;
Destroyer m_Destroyer[2];
};
11. class Player
배 객체들을 가지고 있다
•Aircraft, Battleship, Cruiser, Destroyer(x2)
내 배들을 배치한다.
상대방의 공격에 피격 체크 결과를 알려준다.
맵 객체들을 가지고 있다.
상대방을 공격 한다.
12. class Player
내 배들의 위치를 출력하자.
int _tmain(int argc, _TCHAR* argv[])
{
Player player;
player.SetupShips();
player.PrintShips();
getchar();
return 0;
}
13. class Player
배 객체들을 가지고 있다
•Aircraft, Battleship, Cruiser, Destroyer(x2)
내 배들을 배치한다.
상대방의 공격에 피격 체크 결과를 알려준다.
맵 객체들을 가지고 있다.
상대방을 공격 한다.