Re: Find_My_Vehicle [message #457045 is a reply to message #456821] |
Fri, 07 October 2011 00:27   |
 |
Omar007
Messages: 1711 Registered: December 2007 Location: Amsterdam
Karma:
|
General (1 Star) |
|
|
VehicleGameObject is derived from GameObject.
This means VehicleGameObject is everything GameObject is +more.
The code for this would be
class VehicleGameObject : public GameObject{...};
*note: In the scripts.dll source, there might be an inheritance in between or multiple inheritance. I did not check this code so it may look a bit different in the real source. This does however reflect how VehicleGameObject is a GameObject
You can ofcourse have this stacked
class X{...};
//Y is X +more
class Y : public X{...};
//Z is Y +more
class Z : public Y{...};
As Z derives from Y, and Y from X, Z is also an X.
Or multiple
class A{...};
class B{...};
class C : public A, B{...};
C is both an A and B, BUT A is not a B and B is not an A in this case.
http://www.cprogramming.com/tutorial/lesson20.html
Then you also get things like access modifiers and the virtual keyword that all affect inheritance behavior, but you can search that up when you need it
[Updated on: Fri, 07 October 2011 00:37] Report message to a moderator
|
|
|