Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Abstract Generic class?
Message
De
13/10/2009 11:29:17
 
 
À
13/10/2009 11:21:10
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01429024
Message ID:
01429185
Vues:
41
>>
>>(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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform