Esenthel
Administrator
|
RE: Character went out from a car
__super can call base methods of the base class
|
|
01-21-2010 05:19 PM |
|
Harry
Member
|
RE: Character went out from a car
struct Base
{
virtual void abc(); // first
....
}
struct Xyz:Base
{
virtual void abc(); // second
virtual Bool update();
}
Bool Xyz::upadate()
{
abc(); // i use function from struct Base
__super()::update();
abc(); // i use function from struct Xyz::Base
return true;
}
And now ?
|
|
01-21-2010 05:48 PM |
|
Esenthel
Administrator
|
RE: Character went out from a car
nope,
it works this way:
Code:
struct Base
{
virtual void abc(); // first
....
}
struct Xyz : Base
{
virtual void abc(); // second
virtual Bool update();
}
Bool Xyz::upadate()
{
__super()::abc(); // i use function from struct Base
abc(); // i use function from struct Xyz::Base
__super()::abc(); // i use function from struct Base
abc(); // i use function from struct Xyz::Base
return true;
}
|
|
01-21-2010 05:56 PM |
|
Harry
Member
|
RE: Character went out from a car
Ok now I understand it. Thanks.
|
|
01-21-2010 06:28 PM |
|
Harry
Member
|
RE: Character went out from a car
I have this error:
error C2259: 'policeCar' : cannot instantiate abstract class
Code:
struct Car : Game::Obj
{
...
}
struct policeCar : Car
{
...
}
Game::ObjMemx<policeCar > policeCars; // container for vehicle objects
.setObjType(policeCars,OBJ_VEHICLE )
Reference<policeCar>refCar;
What is wrong here? Is it better to create car which base on Game::Obj or make it as struct without base (is it possible?). How can I set car in right place in World by using second method?
|
|
01-26-2010 10:48 PM |
|
Esenthel
Administrator
|
RE: Character went out from a car
error C2259: 'policeCar' : cannot instantiate abstract class
you must define all methods which are declared in the header with "=NULL" at the end (check tutorial for extending base game object class)
|
|
01-26-2010 11:41 PM |
|
Harry
Member
|
RE: Character went out from a car
Why when this lines:
wheel[0].angle(carAngle).accel(accel).brake(brake);
wheel[1].angle(carAngle).accel(accel).brake(brake);
are called in my code, fps value harshly fall? (from 50 to 17 for example). I have them in PoliceCars::update and all cars is based on Item objects.
|
|
03-17-2010 06:26 PM |
|