eugene.litvinov Posted March 11, 2011 Posted March 11, 2011 I have two classes: class BaseObject { private: Node node; string name; public: void init(Node node, string name = "") { this.node = node; this.name = name; log.message("BaseObject::init()\n"); } string getName() { return name; } Node getNode() { return node; } void setName(string value) { name = value; } void setNode(Node value) { node = value; } void shutdown() { } void update() { } }; class SwitchObject : BaseObject { public: void init(Node node) { BaseObject::init(node); log.message("SwitchObject::init()\n"); } void shutdown() { BaseObject::shutdown(); } void update() { BaseObject::update(); } }; If I do next: SwitchObject object = new SwitchObject(); object.init(someNode); all good, I see trace: BaseObject::init() SwitchObject::init() If I do next: BaseObject object = new SwitchObject(); object.init(someNode); I see trace: BaseObject::init() It's not correct
steve3d Posted March 11, 2011 Posted March 11, 2011 you're requesting a virtual function feature in script engine. I think that's not posible nor easy task for a script engine.
frustum Posted March 12, 2011 Posted March 12, 2011 I have two classes: All functions are treated as virtual. Try use same signatures for init function. init(Node node, string name = "") and init(Node node) is different functions from script point of view.
eugene.litvinov Posted March 12, 2011 Author Posted March 12, 2011 All functions are treated as virtual. Try use same signatures for init function. init(Node node, string name = "") and init(Node node) is different functions from script point of view. I see, thanks
eugene.litvinov Posted March 12, 2011 Author Posted March 12, 2011 you're requesting a virtual function feature in script engine. I think that's not posible nor easy task for a script engine. You are developing very powerful system: beautiful render, excellent cross-platform engine and internal script, that allow abstract from specific platform - IMHO, you should little by little upgrade you script OOP features - it will be amazing for developing :)
steve3d Posted March 12, 2011 Posted March 12, 2011 well, my mistake :) , I didn't notice you are using different parameters, so these different parameter make these two function as normal member function. So what you get is correct result. Actually I use OOP everyday :)
Recommended Posts