DICS Purnea

DICS Purnea

  • NA
  • 29
  • 679

Abstract Class implements the methods of Interface

Aug 28 2019 12:49 AM
Any one help me to answer the below issue. We have one interface ICollection and one abstract class CollectionBase that inherit the ICollection. That already define in System.Collections library.
  1. [ComVisible(true)]  
  2. public interface ICollection : IEnumerable  
  3. {  
  4. int Count { get; }  
  5. object SyncRoot { get; }  
  6. bool IsSynchronized { get; }  
  7. void CopyTo(Array array, int index);  
  8. }  
  9. //Abstract Class  
  10. public abstract class CollectionBase : IList, ICollection, IEnumerable  
  11. {  
  12. protected CollectionBase();  
  13. protected CollectionBase(int capacity);  
  14. [ComVisible(false)]  
  15. public int Capacity { getset; }  
  16. public int Count { get; }  
  17. protected ArrayList InnerList { get; }  
  18. protected IList List { get; }  
  19. public void Clear();  
  20. public IEnumerator GetEnumerator();  
  21. public void RemoveAt(int index);  
  22. protected virtual void OnClear();  
  23. protected virtual void OnClearComplete();  
  24. protected virtual void OnInsert(int index, object value);  
  25. protected virtual void OnInsertComplete(int index, object value);  
  26. protected virtual void OnRemove(int index, object value);  
  27. protected virtual void OnRemoveComplete(int index, object value);  
  28. protected virtual void OnSet(int index, object oldValue, object newValue);  
  29. protected virtual void OnSetComplete(int index, object oldValue, object newValue);  
  30. protected virtual void OnValidate(object value);  
  31. }  
As we know that the class which inherits interface that we must have to implements all methods of the interface. How it is possible that CollectionBase class that didn't implements all the methods of ICollection Interface.

Answers (5)