Function overriding with argument inheritance -
I have a general item list class, to create a more specific list that uses it as a base class, Some ..
Referee class item-badge {} referee class item one: itembase {} Ref Class Maddist summary {public: Add virtual zero (item box ^ P); } Ref class item list A: Madlist (public: Add virtual zeros (alcoholia ^ P) override; // This does not work :(} I want to control adding.
accepted pattern base class method protected < / Code> Creating:
Ref Class Item Box {ref} Category Item: Item: Item Buzz {} Ref Slash Item Element Essentials {Protected: Virtual Zero addInternal (Item Box ^ P);} Ref Class Item List A: Radial {Public: Virtual Zero Addition (Item A ^ P) {addInternal (p);}}< / Pre>Here's a better solution for using generic. Note that how do we force the normal parameter
TtoItemBase, implement it For that this collection should only be used withItemBaseor its subclasses.Referred The class item item {}; Ref class item: public itembase {}; generic & lt; Class T & gt; Where T: itembash ref class itemlist summary {public: add virtual zeros (tp) {}}; Ref Class item item: list: item list & lieutenant; Item A ^> {// no add here to override Ed}; // use int main (arrayargs) {item list a ^ list = gcnu mandista (); List-> Add (GCNE alcoholicum); }
Comments
Post a Comment