Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-06-2003, 10:31 AM   PM User | #1
jimmy_bbq
New to the CF scene

 
Join Date: Mar 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jimmy_bbq is an unknown quantity at this point
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
jimmy_bbq is offline   Reply With Quote
Old 03-07-2003, 12:53 AM   PM User | #2
djdante97
New Coder

 
Join Date: Dec 2002
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
djdante97 is an unknown quantity at this point
Re: OOP inheritance

Quote:
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?
djdante97 is offline   Reply With Quote
Old 03-07-2003, 04:49 AM   PM User | #3
jimmy_bbq
New to the CF scene

 
Join Date: Mar 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
jimmy_bbq is an unknown quantity at this point
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....
jimmy_bbq is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:16 AM.


Advertisement
Log in to turn off these ads.