Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with inherited class

Status
Not open for further replies.

jbpelletier

Programmer
Sep 8, 2001
232
CA
Here is my problem...
i dont know how i should implement the TSquare class witch is inherited from TShape... i tried different thing but i already have an error in relation with the construtor...


-UMain.cpp------------------
#include "Uboard.h"
.....
TFrmMain *FrmMain;
Board TBoard(FrmMain);
.....

-UBoard.h-----------------
#include "USquare.h"
.....
class TBoard
{
protected:
.....
public:
TBoard(TComponent*); //const : build an array 8*8
//of Tsquare
.....
};

-USquare.h-----------------
class TSquare:TShape
{
protected:
.....
public:
TSquare(??????????); //construtor
.....
};

TSquare::TSquare(???????):TShape(???????)
{
......
}

------------------------------
any help will be apreciate....

jb pelletier

 
jb,

Since this only a skeleton I cannot really tell what you are trying to do, but I think that your problem lies in the definition of the TSquare constructor:

TSquare::TSquare(???????):TShape(???????)
{
......
}


The stuff that follows the ":" in a constructor definition is basically data initialization that is to occur before the body of the constructor is entered. I suspect that your intent is different: you think that you are specifying that TSquare is derived from TShape... that is not at all what this expression means! You have already specified the inheritance in the "class TSquare : TShape" expression...

Bob Gallaway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top