Announcement

Collapse
No announcement yet.

Klassen in einer Konsolenanwendung

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Klassen in einer Konsolenanwendung

    Hallo erst mal!

    Ich möchte eine Klasse definieren und dementsprechend auch einige Memberfunktionen. Die Klasse selbst zu erstellen ist nicht das Problem. Nun kommts aber: Sobald ich eine Klassen-Funktion (ausserhalb) der Klassen-Definition erstellen möchte bekomme ich folgende Meldung:<P>

    E2333 Class member 'bool Ttest::m_GetSectionName(int)' declared outside its class

    und<P>

    E2040 Declaration terminated incorrectly<P>

    Um eines auszuschliessen: Der Code funktioniert unter VC++ und als normale Applikation (BCB) einwandfrei.

    Warum aber funktioniert das nicht in einer Konsolenanwendung(VCL)? Hat jemand eine Idee?

    Hier mal ein Beispiel Code:

    <PRE>
    //---------------------------------------------------------------------------

    #include <vcl.h>
    #include <iostream.h>

    #pragma hdrstop

    //---------------------------------------------------------------------------

    #pragma argsused

    <P>

    class Tconfig
    {
    private:
    TStringList *TInfoOld;
    TStringList *TInfoNew;
    int ListLen;
    public:
    bool m_GetSectionName(int Line);
    };
    <P>
    bool Tconfig::m_GetSectionName(int Line);
    {
    return 0;

    }
    <P>
    int main(int argc, char* argv[])
    {
    /* init application */
    Tconfig TObject;
    int input;

    /* other code goes here */
    cin >> input;

    return 0;
    }
    </PRE>

  • #2
    Das Semikolon am Ende der Zeile ist falsch

    "bool Tconfig::m_GetSectionName(int Line);"

    {

    ..

    }

    Der Compiler geht davon aus, die Deklaration erfolgt nochmals außerhalb der Klasse.
    Christian

    Comment

    Working...
    X