Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcopying one array into another -simple question Pin
nss4-Aug-02 13:38
nss4-Aug-02 13:38 
GeneralRe: copying one array into another -simple question Pin
Christian Graus4-Aug-02 14:22
protectorChristian Graus4-Aug-02 14:22 
GeneralRe: copying one array into another -simple question Pin
nss4-Aug-02 15:05
nss4-Aug-02 15:05 
GeneralRe: copying one array into another -simple question Pin
Ravi Bhavnani4-Aug-02 14:53
professionalRavi Bhavnani4-Aug-02 14:53 
GeneralRe: copying one array into another -simple question Pin
Daniel Lohmann5-Aug-02 3:56
Daniel Lohmann5-Aug-02 3:56 
GeneralOO design question Pin
David Wulff4-Aug-02 12:55
David Wulff4-Aug-02 12:55 
GeneralRe: OO design question Pin
Ravi Bhavnani4-Aug-02 15:00
professionalRavi Bhavnani4-Aug-02 15:00 
GeneralRe: OO design question Pin
David Wulff4-Aug-02 15:32
David Wulff4-Aug-02 15:32 
Thanks Ravi.

Ravi Bhavnani wrote:
Is your diagram an object inheritance chart or (as I suspect) is it meant to show the "is born to" relation? They are 2 very different things.

It was *meant* to be an inheritance chart. Then again, I didn't pay much attention to that in class...

Ravi Bhavnani wrote:
If it's an inheritance chart and the age methods are publicly defined in Parent, objects that inherit from it will also inherit the methods. ... [etc]

That much I understand (wow!) but what is confusing me is say the Son and Daughter objects each provide overridden Get/SetAge methods, and the Parent object's method is called from within each to perform some common task. Now if I call Grandchild's GetAge member what gets used? Would it even work? If so, would the Parent's member get called twice?

My example of ages is getting a little confusing, so let me explain the real problem I am looking at:

In a game we have many CGameObject's:
       GameObject
      ^         ^
     /           \
Animatable    Intelligent     ... (there are more)
GameObject     GameObject
     ^            ^
      \          /
    PlayerGameObject

GameObject provides a virtual method called Frame which is called each frame in the game to allow the object to perform any actions if required to. The GameObject.Frame method performs some basic "all objects require this" actions. The AnimatableGameObject.Frame method updates the animation status, etc. The IntelligentGameObject.Frame method evaluates the AI state of the object and calls its own methods as appropriate. The PlayerGameObject.Frame performs some calculations using user input and various other factors. Now I want PlayerGameObject.Frame to perform all of the tasks of all of the overriden (inclusing its own) and the original methods. Exactly how, if at all, would this work? Could I do something like:

PlayerGameObject::Frame()
{
    // do stuff here
    
    AnimatableGameObject::Frame(); // call parent method
    InteligentGameObject::Frame(); // call other parent method
}

How would GameObject::Frame be called if both the AnimatableGameObject and InteligentGameObject overidden methods call it? Argh - my head!


One 18yrs male, red and white, good condition; daily servicing required. £500 collect ono.
GeneralRe: OO design question Pin
Shog94-Aug-02 19:45
sitebuilderShog94-Aug-02 19:45 
GeneralRe: OO design question Pin
David Wulff5-Aug-02 1:33
David Wulff5-Aug-02 1:33 
GeneralRe: OO design question Pin
Shog95-Aug-02 5:14
sitebuilderShog95-Aug-02 5:14 
GeneralRe: OO design question Pin
David Wulff5-Aug-02 6:46
David Wulff5-Aug-02 6:46 
GeneralRe: OO design question Pin
Stan Shannon5-Aug-02 8:47
Stan Shannon5-Aug-02 8:47 
GeneralRe: OO design question Pin
Stan Shannon5-Aug-02 2:04
Stan Shannon5-Aug-02 2:04 
GeneralRe: OO design question Pin
David Wulff5-Aug-02 2:29
David Wulff5-Aug-02 2:29 
GeneralRe: OO design question Pin
Stan Shannon5-Aug-02 3:43
Stan Shannon5-Aug-02 3:43 
GeneralRe: OO design question Pin
Ravi Bhavnani5-Aug-02 3:37
professionalRavi Bhavnani5-Aug-02 3:37 
GeneralRe: OO design question Pin
Tomasz Sowinski4-Aug-02 23:51
Tomasz Sowinski4-Aug-02 23:51 
GeneralRe: OO design question Pin
David Wulff5-Aug-02 1:22
David Wulff5-Aug-02 1:22 
Generalusing CBitmapButton Pin
Mavrock4-Aug-02 11:58
Mavrock4-Aug-02 11:58 
GeneralRe: using CBitmapButton Pin
Ravi Bhavnani4-Aug-02 15:00
professionalRavi Bhavnani4-Aug-02 15:00 
GeneralGetting selected text globally Pin
Christian Skovdal Andersen4-Aug-02 11:19
Christian Skovdal Andersen4-Aug-02 11:19 
GeneralRe: Getting selected text globally Pin
Tomasz Sowinski5-Aug-02 0:07
Tomasz Sowinski5-Aug-02 0:07 
GeneralRe: Getting selected text globally Pin
Gene Yu14-Jan-03 8:56
Gene Yu14-Jan-03 8:56 
GeneralDefault font set for window's dialogs Pin
CaesarCZ4-Aug-02 10:28
CaesarCZ4-Aug-02 10:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.