.net - Question inheriting from List(of T) class -
I want to apply the priority queue class.
Common lines of code
When the public class is pushed in front of the queue instead of adding it at the end of the queue. List of Priority Questions (Number of T) (TK) Private List as New List (TK) Public Sub-Enw (ByVal Item T, Boolean = False as Alternative ByVal pushToFront) If pushToFront = true then _list.Instert (0, item) otherwise _list.Add (item) end if end_list.Count & End of all folk function deck () t & Gt; 0 then dim item _ _list (0) _list.RemoveAt (0) return items other new invalid operation expansion end if end function end class calling function now Try to find elements in the queue like this.
Due to the new priority _q.Enque (1) _q.Enque (2) msgbox ( _q.Count ()) .....
The program prints from 0! If any calculation () adds assets, then everything is fine. I would have thought that the legacy class should call the base function's GIN function. Note that count is shown in intellisense even though I have no implementation in the derived class.
Your problem is that you get both from list (TK) And you have a property property like this, this is where you are storing your data when your code is called calculation , then it's your parent The list (TK) is using the , which is not there where you are accumulating your data. calculation property from
A better idea would be for you to inherit from object and priority QU (TK) apply Icon and IEnumerable (of T) You should not have changed your internal implementation at all, you need to add the code in support of those interfaces.
Comments
Post a Comment