Wrox Programmer Forums
|
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 30th, 2005, 08:02 PM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default To Override or Not to Override

I'm developing a simple app which counts the number of times an instance is called.In my demo class I employ a constructor to keep track of each instance. The demo class is illustrated below:

Public Class Demo
    Public Sub New()
        Instances += 1
    End Sub
    Protected Overrides Sub Finalizer()
        Instances -= 1
    End Sub
    Public Shared Instances As Long
End Class

My question is :Why do I get the jagged lines beneath the term Finalizer? When I highlight Finalizer it states:
         "Sub Finalizer cannot be declared 'Overrides' because it does not override a sub in a base class."
Yet it is my understanding that in VB.Net I MUST use the overrides keyword since Finalizer is a method called automatically by .Net.
If I remove the 'Overrides' keyword the app appears to run as expected;however this leaves me a little confused. Can anyone explain ?



 
Old May 2nd, 2005, 01:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

There isn't a Finalizer method, but a Finalize method...

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why would you override ToString()? chobo2 C# 2008 aka C# 3.0 16 November 11th, 2008 11:01 PM
Configuration Override Files Jeff Mason Visual Studio 2005 1 March 14th, 2007 08:52 AM
how to override equals() and hashcode() praveena Java Basics 3 March 14th, 2006 02:30 AM
How can I write query for override a table?? davekrunal46 SQL Language 7 December 1st, 2005 01:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.