int main(){
....
....
CGraphics draw;//creates an object of CGraphics class
CShape cBlock;//creates an object of CShape class
draw.drawBorder();//draws a blue border
draw.printText();
cBlock.assignBorderValues();
// openingSound();
genBlock = generateBlock();//generate random blocks
//is this declaration wrong?
CShape * chosenBlock = &(cBlock.SetGeneratedBlock(genBlock));
}
I only copy the syntax from an example in a book
1 2 3 4
CRectangle rect;
CTriangle trgl;
CPolygon * ppoly1 = ▭//<---I copied this syntax, since the return value of my code is
CPolygon * ppoly2 = &trgl;// an object of a subclass.
That's why I have this declaration in my function...
1 2 3 4 5 6 7 8 9 10 11
typedef /*what will I put here*/ SetGeneratedBlock(int bGen)
{
constint BLOCKL = 1, BLOCKZ = 2, BLOCKS = 3, BLOCKT = 4, BLOCKI = 5;
CShapeL lshape; //<--I create the derived object first then I pass the value to main function
CShapeZ zshape;
CShapeS sshape;
CShapeT tshape;
CShapeI ishape;
...
...
}