Why method Dispose from IDisposable is not virtual?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Why method Dispose from IDisposable is not virtual?

  1. #1
    Join Date
    Jul 2005
    Posts
    894

    Why method Dispose from IDisposable is not virtual?

    What is the reason behind that?Thanks.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    10,956

    Re: Why method Dispose from IDisposable is not virtual?

    Why should it be virtual?

  3. #3
    Join Date
    Jul 2005
    Posts
    894

    Re: Why method Dispose from IDisposable is not virtual?

    Quote Originally Posted by Arjay View Post
    Why should it be virtual?
    Ok, maybe we can put aside virtual or non-virtual for the time being. There is another question that if a class implements IDisposable, why should the class have to implement the method Dispose from IDisposable? Thanks.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    10,956

    Re: Why method Dispose from IDisposable is not virtual?

    Quote Originally Posted by LarryChen View Post
    Ok, maybe we can put aside virtual or non-virtual for the time being. There is another question that if a class implements IDisposable, why should the class have to implement the method Dispose from IDisposable? Thanks.
    Because that's how interfaces are designed and that's how an interface differs from using a base class or abstract base class.

    Now if you are wondering why IDisposable has been implemented the way it is, why not use bing or google to help?

    Try searching bing for "Why was IDisposable designed the way it is?"

    http://stackoverflow.com/questions/2...-the-way-it-is
    http://reedcopsey.com/tag/idisposable/

    There is much on this subject, I'm wondering why you haven't found it yourself. Is your google kung fu that weak?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center