Search the Community
Showing results for tags 'inheritance'.
-
Hi, In the attached sample, executed in: Binary: Windows 64bit Visual C++ 1600 Release Jun 4 2014 r14513 ---- System ---- System: Windows 8 (build 9200) 64bit CPU: Intel® Core i7 CPU 960 @ 3.20GHz 3238MHz MMX SSE SSE2 SSE3 SSSE3 SSE41 SSE42 HTT x4 GPU: NVIDIA GeForce GTX 560 Ti 9.18.13.3750 x1 System memory: 22526 MB Video memory: 1024 MB When the 'z' key is pressed all the elements in the intances array must execute IMyInterface::foo(), the problem is CClass instance is not recognized as a class implementing IMyInterface despite it inherits the BClass that it does. I think is not a good solution to have to redeclare the interface for all the descendant classes (the current workaround I used) Best regards, Iván. interface_bug.cpp interface_bug.world
-
Здравствуйте. Проблема с наследованием в классах Flash. Простой пример прилагается. Результаты во Flash и Unigine разные. вкратце: Проблема заключается в обращении из frame к функции (в примере Hide() ), которая имеет одинаковое имя во всех трех классах. Мы вызываем Hide() из FIRST, а срабатывает Hide из SECOND. Проблема исчезнет если убрать у классов наследников наследование от родителя "extends _main". Спасибо. ===================== translation from google ===================== Hello The problem with inheritance in classes Flash. A simple example is attached. Results in Flash and Unigine different. briefly: The problem is to use a function of the from frame (in the example Hide() ), which has the same name in all three classes. We call Hide() from FIRST, and works from Hide SECOND. The problem goes away if you remove the classes of heirs to inherit from parent "extends _main". Thank you. flash.rar
- 2 replies
-
- flash
- WidgetFlash
-
(and 3 more)
Tagged with:
-
I'm seeing inconsistent and unexpected behaviour when trying to set variables passed by reference (possibly related to inheritance). See example below: class MyBase { public: void TestSetByReference(int& result) { result = 17; } }; class MyDerived : MyBase { public: void TestSetByReference(int& result) { result = 34; } }; MyBase base = new MyDerived(); MyDerived derived = new MyDerived(); int i = -1; derived.TestSetByReference(i); log.message("derived.TestSetByReference = %d \n",i); i = -1; base.TestSetByReference(i); log.message("base.TestSetByReference = %d \n",i); i = -1; MyBase(base).TestSetByReference(i); log.message("MyBase(base).TestSetByReference = %d \n",i); i = -1; MyBase::TestSetByReference(i); log.message("MyBase::TestSetByReference = %d \n",i); i = -1; MyDerived(base).TestSetByReference(i); log.message("MyDerived(base).TestSetByReference = %d \n",i); i = -1; MyBase(base).TestSetByReference(i); log.message("MyBase(base).TestSetByReference = %d \n",i); // Output: derived.TestSetByReference = 34 base.TestSetByReference = 0 <--- ?? MyBase(base).TestSetByReference = 0 <--- ?? The same call gives a different result below MyBase::TestSetByReference = 17 MyDerived(base).TestSetByReference = 34 MyBase(base).TestSetByReference = 17 <--- ?? Different result, but still wrong Performing the same example except returning by value gives expected results (i.e. result is always 34, except when base class method is explicity called via MyBase:: ) Is this a known bug or limitation?
-
I don't know if it's possible, but it will be great to have the possibility to make your own class with inheritance of intern class of unigine, example, my own widget inheritance of Widget class. Today, for do that, i make my class with an attribute Widget, and an function getWidget, work fine. But, have a real inheritance will be very userful Thanks.