OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000090OMNeT++simulation kernelpublic2009-07-24 17:112009-07-25 12:37
ypsilon 
andras 
normalmajoralways
resolvedno change required 
4.0 
 
0000090: simple module inheritance does not work - parent class is used instead of child
given:
child module with class/name Child, parent module with class/name Parent
network:
using child module
expected:
class Child is used
observed:
class Parent is used

see test file and results below:
*** cSimpleModule_inheritance.test: FAIL (stdout fails %contains(1) rule)
expected substring:
>>>>Initializing...
Initializing module Test, stage 0
Initializing module Test.child, stage 0
child Test.child<<<<
actual output:
>>>>OMNeT++ Discrete Event Simulation (C) 1992-2008 Andras Varga, OpenSim Ltd.
Version: 4.0, build: 090310-10709, edition: Academic Public License -- NOT FOR COMMERCIAL USE
See the license for distribution terms and warranty disclaimer
Setting up Cmdenv...
Loading NED files from .: 2
Loading NED files from ../lib: 4

Preparing for running configuration General, run #0...
Scenario: $repetition=0
Assigned runID=General-0-20090724-18:09:43-8533
Setting up network `Test'...
Initializing...
Initializing module Test, stage 0
Initializing module Test.child, stage 0
parent Test.child

Running simulation...

<!> No more events -- simulation ended.


Calling finish() at end of Run #0...

End.
<<<<
========================================
PASS: 0 FAIL: 1 UNRESOLVED: 0
No tags attached.
? cSimpleModule_inheritance.test (817) 2009-07-24 17:11
https://dev.omnetpp.org/bugs/file_download.php?file_id=17&type=bug
Issue History
2009-07-24 17:11ypsilonNew Issue
2009-07-24 17:11ypsilonFile Added: cSimpleModule_inheritance.test
2009-07-25 12:36andrasNote Added: 0000159
2009-07-25 12:37andrasStatusnew => resolved
2009-07-25 12:37andrasResolutionopen => no change required
2009-07-25 12:37andrasAssigned To => andras

Notes
(0000159)
andras   
2009-07-25 12:36   
This is the expected behavior. The class is inherited from the parent; to override it, use @class(ClassName).

This is described at several places in the manual: NED chapter "3.3 Simple modules", "3.13 Inheritance"; Appendix NED Reference "17.4.7 Resolving the implementation C++ class"