Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Mustinherit And Assembly visibility
 

Mustinherit And Assembly visibility

Into a class library I have these two classes:

Public MustInherit Class AA

...

Public Class BB: Inherits AA

..

Now,externally of my assembly i want to see BB class, but not the AA class.
How can i do?


Riccardo
Riccardo63  Monday, October 13, 2008 4:58 PM
The keyword that specifies the assembly level is "Friend" (Friend MustInherit Class AA). However, you cannot use it here because it will result in the following compile-time error:

Error1'BB'cannotinheritfromclass'AA'becauseitexpandstheaccessofthebaseclassoutsidetheassembly.

As a workaround, instead of declaring the entire AA class Friend, you might consider whether declaring the relevant methods in AA to be "Friend" will meet your needs.

  • Edited byBinaryCoder Monday, October 13, 2008 11:27 PM
  • Marked As Answer byRiccardo63 Tuesday, October 14, 2008 6:50 AM
  •  
BinaryCoder  Monday, October 13, 2008 11:26 PM
The keyword that specifies the assembly level is "Friend" (Friend MustInherit Class AA). However, you cannot use it here because it will result in the following compile-time error:

Error1'BB'cannotinheritfromclass'AA'becauseitexpandstheaccessofthebaseclassoutsidetheassembly.

As a workaround, instead of declaring the entire AA class Friend, you might consider whether declaring the relevant methods in AA to be "Friend" will meet your needs.

  • Edited byBinaryCoder Monday, October 13, 2008 11:27 PM
  • Marked As Answer byRiccardo63 Tuesday, October 14, 2008 6:50 AM
  •  
BinaryCoder  Monday, October 13, 2008 11:26 PM
Ok Binarycoder. This meet my needs.
However, I've another question: is it right to see externally my abstract classes? (With intellisense for example).
What is the best practice in this case?
thanks.

Riccardo
Riccardo63  Tuesday, October 14, 2008 6:51 AM

You can use google to search for other answers

Custom Search

More Threads

• Problems with namespaces in LINQ [Visual Basic 2008]
• How do you convert Integer to System.ConsoleColor with Option Strict On?
• About the resolution of the screen ?
• Key Press Events
• Noughts and Crosses picture help!
• VB2008 How to get a string array of member | datamember names from a class object
• How to escape double quotes (") in tab delimited text file ? Urgent - please any idea is welcome
• Function parameter passing and objects
• Password Protect Form
• i need an out look clone in my project any one can help me