Tuesday, February 24, 2009

deklarasi kelas di c++

barusan aku bikin deklarasi kelas kek gini

class ServerReconet{
public :
ServerReconet();
~ServerReconet();

int initServerReconet();


private:
int no_port;
wxIPV4address addr; // default adalah localhost = 127.0.0.1
wxSocketServer *sr_server;
wxString *sr_text;
bool sr_busy;
int sr_numClients;
}
/** konstruktor
***
**/
ServerReconet::ServerReconet()
{
no_port = 3000;

//addr =
}

/** destruktor
***
**/
ServerReconet::~ServerReconet()
{
delete sr_server;
}

turn out pas aku build keluar error
error: new types may not be defined in a return type
dimana ntu error nunjuk ke line-nya konstruktor

binun kan
??
masak kontruktor ada return valuenya
???

akhirnya gugle
n i bump to this link --> http://www.daniweb.com/forums/thread90475.html
=="

ternyata oh ternyata

kurang semicolon setelah deklarasi class
so the class declaration should be like this
class ServerReconet{
// /bla bla

};

problem solved deh :d