Cannot overload the Finalize() method, why ?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Cannot overload the Finalize() method, why ?

  1. #1
    Louis-Philippe Carignan Guest

    Cannot overload the Finalize() method, why ?


    Hi all,

    Why can't the methode Finalize() from the System.Object be overloaded by
    a child class. The compiler forces me to write a destructor instead. I
    don't mind but why include a Finalize() method if we cannot do anything with
    it ?

    Also, which function get called first, Finalize() or the destructor ? I'm
    betting Finalize() and then the destructor but I was just curious.

    Thanks,

    Louis-Philippe

  2. #2
    Mattias Sjögren Guest

    Re: Cannot overload the Finalize() method, why ?

    Louis-Philippe,

    >Why can't the methode Finalize() from the System.Object be overloaded by
    >a child class. The compiler forces me to write a destructor instead. I
    >don't mind but why include a Finalize() method if we cannot do anything with
    >it ?



    It's the same thing. When you add a "destructor" to a C# class, you
    actually do override Finalize. It's just hidden from you using this
    special syntax.


    Mattias

    ===
    Mattias Sjögren (VB MVP)
    mattias @ mvps.org
    http://www.msjogren.net/dotnet/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center