[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] multiple inheritance




But multiple interhance is a Bad Idea, regardless of what language
you're using.

You don't say WHY you want to do this, but I suggest you consider
aggregating functionality using composition.  If you look at the
current ns code, the current node structure does things this way and
BaseStationNode no longer works the way you describe it (or it
shouldn't!).  See for example the node-config command and how nodes
are constructed.

   -John Heidemann


>I think you can do,
>
>Class <HybridClass> -superclass {<class1> <class2>...}
>
>as long as there are no conflicts in names and instvars.
>
>Enrique Campos-Nanez
>
>On Wednesday, May 30, 2001, at 04:21  PM, Bhagyalaxmi Bethala wrote:
>
>> I would like to know how do you go about doing this in .tcl file. As in
>> the file tcl/lib/ns-bsnode.tcl, they define BaseSattionNode as follows
>>
>> Class Node/MobileNode/BaseStationNode -superclass Node/MobileNode
>>
>> now if i want to have multiple inheritance here what will i do??
>>
>> Thanks
>> Bhagya
>>
>>
>> On Wed, 30 May 2001, Debojyoti Dutta wrote:
>>
>>> you can define a class X to inherit from Y, Z
>>>
>>> class X : public Y, Z {
>>>
>>> }
>>>
>>> -debo
>>>
>>>
>>> On Wed, 30 May 2001, Bhagyalaxmi Bethala wrote:
>>>
>>>> hi,
>>>>   Does anybody know how can a new class be created by inheriting it 
>>>> from
>>>> more than one class. For example, in the BaseStationNode, of
>>>> ns../tcl/libns-bsnode.tcl, they say base station is actually a hybrid
>>>> between mobilenode and hiernode. Can this be done?? If yes how should 
>>>> it
>>>> be done??
>>>>
>>>> Thanks in advance
>>>> Bhagya
>>>>
>>>>
>>>>
>>>
>>>
>