Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: OOP inheritance

  1. #1
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OOP inheritance

    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

  • #2
    New Coder
    Join Date
    Dec 2002
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OOP inheritance

    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?

  • #3
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •