Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Abstract Generic class?
Message
From
13/10/2009 11:29:17
 
 
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01429024
Message ID:
01429185
Views:
43
>>
>>(1) Generics are nice and fine, but sometimes the mind needs a boost to see how to put them together
>
>I think mine needs more than a boost - maybe a complete re-wire :-}
>
>>(2)
>>Can you move Initialize(u); into the parent class ? ( I may be wrong - difficult to follow the class/subclass/generic logic when you didn't write it yourself)
>
>'Initialize((U) tm);' works - but I think it's six of one / half dozen of the other ?
>Regards,
>Viv



The way I was looking at it, is just that specifying :base() in the constructor is sufficient. You do not have to remember to call Initialize() the next time you subclass it


>
>>
>>Parent
>>
>>>        public BaseTVItemViewModel(Interfaces.IsTreeModel<U> tm)
>>>        {
>>>            _treeModel = tm;
>>              Initialize(tm);
>>>        }
>>
>>
>>Then the constructor of the derived class would become
>>
>>
>>>        public UIItemTVModel(UIItem u)
>>>            : base(u)
>>>        {
>>>          //  not needed  Initialize(u);
>>>        }
>>>
>>
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform