[c++] finde Fehler in der Klassenerstellung nicht :(

kodak

Mitglied
Hi
ich habe ein kleinesProblem.
Eine Klasse ... normal erstellt mit private und public Deklerationen.
Soweit ich das beurteilen kann, müsste diese Klasse eigendlich richtig erstellt worden sein, aber die Compilerfehlerliste ist endlos.
Könnt ihr mir da helfen?

Code:
struct attributes
{
    short int iStrength;
    short int iDefence;
    short int iVitality;
    short int iIntelegence;
    short int iCharisma;
    short int iAgility;
    short int iDexterity;   
};


class PLAYER
{
public:
    void AddExp(int iExp);
    void LooseExp();
    int  GetExp();

    int  GetStrength();
    int  GetDefence();
    int  GetVitality();
    int  GetIntelegence();
    int  GetCharisma();
    int  GetAgility();
    int  GetDexerity();
   
   




private:
    short int  iExperience;
    short int  iBaseLevel;
    short int  iJobLevel;

    //ATTRIBUTE
    attributes attribute;
    attributes temporaryAttribute;
    attributes jobBasedAttribute;   

    short int  iNumberOfUpLevels;
   

    short int  iHealthPoints;
    short int  iSkillPoints;

    short int  iJobType;



    char Zeichen, WhatToDo;
          string Dateiname, Zeile;
    ifstream Eingabedatei;

};

void PLAYER::AddExp(int iExp) { iExperience = iExperience + iExp; };

void PLAYER:LooseExp() { iExperience = iExperience - (iExperience / 100); };

int PLAYER::GetExp()         { return( iExperience ); };


int PLAYER::GetStrength();    { return( attribute.Strength    + temporaryAttribute.Strength    + jobBasedAttribute.Strength    ); };
int PLAYER::GetDefence();    { return( attribute.Defence     + temporaryAttribute.Defence     + jobBasedAttribute.Defence     ); };
int PLAYER::GetVitality();    { return( attribute.Vitality    + temporaryAttribute.Vitality    + jobBasedAttribute.Vitality    ); };
int PLAYER::GetIntelegence();    { return( attribute.Intelegence + temporaryAttribute.Intelegence + jobBasedAttribute.Intelegence ); };
int PLAYER::GetCharisma();    { return( attribute.Charisma    + temporaryAttribute.Charisma    + jobBasedAttribute.Charisma    ); };
int PLAYER::GetAgility();    { return( attribute.Agility     + temporaryAttribute.Agility     + jobBasedAttribute.Agility     ); };
int PLAYER::GetDexerity();    { return( attribute.Dexerity    + temporaryAttribute.Dexerity    + jobBasedAttribute.Dexerity    ); };


und die Fehlerliste:
c:\Datein\c++\mmporpg>emacs server.h

c:\Datein\c++\mmporpg>bcc32 main.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
main.cpp:
Error E2303 player.h 54: Type name expected
Error E2139 player.h 54: Declaration missing ;
Error E2303 player.h 55: Type name expected
Error E2139 player.h 55: Declaration missing ;
Error E2449 player.h 61: Size of 'PLAYER' is unknown or zero
Error E2141 player.h 61: Declaration syntax error
Error E2333 player.h 66: Class member 'PLAYER::GetStrength()' declared outside its class
Error E2040 player.h 66: Declaration terminated incorrectly
Error E2333 player.h 67: Class member 'PLAYER::GetDefence()' declared outside its class
Error E2040 player.h 67: Declaration terminated incorrectly
Error E2333 player.h 68: Class member 'PLAYER::GetVitality()' declared outside its class
Error E2040 player.h 68: Declaration terminated incorrectly
Error E2333 player.h 69: Class member 'PLAYER::GetIntelegence()' declared outside its class
Error E2040 player.h 69: Declaration terminated incorrectly
Error E2333 player.h 70: Class member 'PLAYER::GetCharisma()' declared outside its class
Error E2040 player.h 70: Declaration terminated incorrectly
Error E2333 player.h 71: Class member 'PLAYER::GetAgility()' declared outside its class
Error E2040 player.h 71: Declaration terminated incorrectly
Error E2333 player.h 72: Class member 'PLAYER::GetDexerity()' declared outside its class
Error E2040 player.h 72: Declaration terminated incorrectly
*** 20 errors in Compile ***
 
Zuletzt bearbeitet:
Viele ; Fehler:

Warum ; nach GetStrength()(...) und jedemBlockende?
Code:
int PLAYER::GetStrength();	{ return( attribute.Strength	+ temporaryAttribute.Strength	+ jobBasedAttribute.Strength	); };

Es müsste so gehen:
Code:
int PLAYER::GetStrength()
{
	return( attribute.Strength	+ temporaryAttribute.Strength  + jobBasedAttribute.Strength	); 
}
Und dasselbe bei den anderen Deklarationen der Memberfunktionen
 
Zurück