Non-static member XXX found in multiple base-class - What can I do?

Hello, who of you can give me fingertip ?

at my h.file I "need "his
class _mainWorld : public lWorldMainScene, public cocos2d::ui::ScrollView{

but after including “public cocos2d::ui::ScrollView” I got his errors at the cpp-files…

ERRORS:

_Non-static member 'autorelease' found in multiple base-class subobjects of type 'cocos2d::Ref':_
_class _mainWorld -> class WorldMainScene -> class LHScene -> cocos2d::Scene -> class cocos2d::Node -> class cocos2d::Ref_

_class _mainWorld -> cocos2d::ui::ScrollView -> class cocos2d::ui::Layout -> class cocos2d::ui::Widget -> class cocos2d::ProtectedNode -> class cocos2d::Node -> class cocos2d::Ref_

This is the common ‘Diamond Inheritance’ problem. Essentially both xxxxScene(S) and ScrollView(SV) both inherit from Ref. see: http://www.cprogramming.com/tutorial/virtual_inheritance.html

Personally, I’d rethink your design. Try to move your concepts into data where possible instead so that you can have them as members instead of inheritance (google “has-a” vs “is-a”).

class world : scene {
   scrollview * sv;
}
1 Like

I will check that… THX

You can make virtual inheritance from a base class[es] in your code and in cocos2dx sources. Edit cocos2dx engine sources is OK, if you know what are you doing.

Do not edit the Game Engine code. It becomes more difficult to upgrade the version of Cocos2DX in the future.