![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Parent* parameter, not using child function (virtual in parent)I am not sure if I am creating a parent class or a child class with this code, but either way, the parent function which is virtual is being called rather then the child function that I want:
Heres various relevant code snippets: CPP / C++ / C Code:
When from my window event I call the function like this... CPP / C++ / C Code:
I end up with either a TerFlag object using the TerBase paint() function or a TerFlag object. Either way what I want is a TerFlag object with the TerFlag paint() function ! Can anyone explain to me please what I should change ? I am assuming that its the "new TerBase(terrain)" line thats causeing the problems, but if I don't know in advance which child class is being passed, how can I get around this ? Last edited by Algar : 03-Nov-2007 at 23:21.
Reason: Better formatting
|
|||
|
#2
|
|||
|
|||
Re: Parent* parameter, not using child function (virtual in parent)Yet another question I solved soon after posting...
I changed the intermedite function to receive a TerBase* instead of a TerBase object. |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How a child process past a value to parent process? | Reny | Computer Software Forum - Linux | 11 | 09-Apr-2007 08:46 |
| How to return value from child process to parent process | Reny | C Programming Language | 1 | 16-Mar-2007 10:38 |
| [Tutorial] Function Pointers | aaroncohn | C++ Forum | 4 | 17-Feb-2006 11:33 |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 13:30 |
| Revising Script style ?????? | pepee | MySQL / PHP Forum | 4 | 14-Apr-2004 04:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The