Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 October 19th, 2006, 04:47 PM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hiding Publicly Declared Base-Class Methods

Hi Forum,

I have a base class with a [u]public method</u>, i.e. MyBaseClass.MethodA(). I have another class defined as follows:

Friend Class MyDerivedClass()
 Inherits MyBaseClass
.
.
.
 Private Shadows Sub MethodA()
.
End Class

I can get away with the following call: MyDerivedClass.MethodA(). How can I prevent this?

Thanks.

Rommel the iCeMAn
Barbados, Carribean
 
Old November 17th, 2006, 05:42 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This happens because that method is available on the base class.

You might want to rethink how you are using inheritance if you are wanting to remove an overridable method from the base class in your implementation of the derived class. This just can't be done. The code that is calling this method will not see the private one you have declared in the derived class and will look for it on the base class, where it will find it.

Woody Z
http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Base Class for Code-Behind Problem groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 3 September 8th, 2004 05:06 AM
classes :: base class is inaccessible .... Kaliste C# 3 July 16th, 2004 04:56 AM
base class inheritance krunch97 VB.NET 2002/2003 Basics 6 April 23rd, 2004 11:48 AM
Hiding elements using identification by class jacob Javascript How-To 4 February 2nd, 2004 03:52 PM
Help with DBObject base class projectedNexus BOOK: ASP.NET Website Programming Problem-Design-Solution 1 August 12th, 2003 06:36 PM





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