...

OOP inheritance

jimmy_bbq
03-06-2003, 10:31 AM
OOP inheritance
Dear everyone,
Is it possible to define the method like this:

Class GameEntity
DoKeyMethod (whichKey)
DoCollisionMethod (whichEntity)
DoStepMethod()


GameEntity:: DoKeyMethod(whichKey)
Switch (whichKey){
Case keyLeft: DoKeyLeftMethod()
Case keyRight: DoKeyRightMethod()


Class Bat : public GameEntity //inherit from GameEntity

Bat:: DoKeyMethod():: DoKeyLeftMethod()
Move the Bat left

Thanks in advance.
jimmy

djdante97
03-07-2003, 12:53 AM
Originally posted by jimmy_bbq
Class Bat : public GameEntity //inherit from GameEntity

Bat:: DoKeyMethod():: DoKeyLeftMethod()
Move the Bat left

Looks ok except for this.. what is this part supposed to do?

jimmy_bbq
03-07-2003, 04:49 AM
I have three methods in GameEntity, called the DoKeyMethod, DoKeyLeftMethod and DoKeyRightMethod. The DoKeyLeftMethod is not defined and is to be defined in Bat who inherits from GameEntity.

Bat:: DoKeyMethod():: DoKeyLeftMethod()
move Bat to left

is to used to define the DoKeyLeftMethod of Bat....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum