Baseball - help

Class Player

{

Public:

Player();

Void SetName(char*);

Void SetNumber(char*);

Void SetPosition(position);

Void AddHits(int);

Void AddABs(int);

Void AddHRs(int);

Const char* GetName() const;

Static const* GetName() const;

GetPositionName(position)

Const char* Player::GetPosition Name(position p)

{

switch(p)

{

case catcher:

return "Catcher";

case pitcher:

return "Pitcher";

.

.

.

default:

return NULL;

}

}

 

Const char* Player::GetName() const

{

return m_szName; //char*

}

//when this function called and returned, m_szName cannot be modified.

Ie/ char*p = m_pPlayer[0].GetName();

In order to compile, must declare as

Const char*p ….. to ensure name’s integrity

 

 

 

Class Team

{

private:

player* m_pPlayer;

Team::Team()

{

n_pPlayer = new aPlayer[25];

 

 

Void Team::Update()

{

//as user for a name

//go thorugh the array

//looking for a player with a name that matches the name entered by the user

for (int I=0; I<???; I++)

{

m_pPlayer[I].GetName();

}

 

 

  1. Use enum (enum is an int), for position

 

 

Back | HOME | Next




Canpol Solutions Przeszukaj Katalog -- przeszukaj katalog / zamowienia, komentarze --  Poczta Polonijnej Witryny

Internet ExplorerUzywaj zawsze najnowszej przegladarki
M.I.E. lub, ewentualnie Netscape ktorej, niestety na razie nie polecamy..
Netscape


Canpol Solutions © Polonijna Witryna