BUG: "Type <Class Name> is not defined" error message when you try to inherit a protected nested class in Visual Basic .NET (820656)
The information in this article applies to:
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
SYMPTOMSWhen you try to inherit a protected nested class in Visual
Basic .NET, you receive the following compilation error message: Type Protected Class Name is not
defined WORKAROUND To work around this problem, change the protected nested
class to a public nested class. When you inherit the nested class, qualify the
nested class with a parent class. The following code demonstrates the
workaround for the example that is listed in the "More Information" section of
this article: Option Explicit On
Option Strict On
Public Class OuterBase
Public Sub New()
'Constructor
End Sub
'Modify this class as public.
Public Class InnerBase
Private a As Integer
Public Sub New()
'Constructor
End Sub
End Class
End Class
Public Class OuterDerived
Inherits OuterBase
Dim ia As OuterBase.InnerBase
'Qualify the Nested class with its Parent.
Protected Class InnerDerived
Inherits OuterBase.InnerBase
Public Sub New()
'Constructor
End Sub
End Class
Public Sub New()
'Constructor
End Sub
End Class
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCESFor more information about implementing nested classes,
visit the following Microsoft Developer Network (MSDN) Web site:
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005doesnotapply kbvs2005swept kbvs2002sp1sweep kbProgramming kbcode kbInheritance kberrmsg kbbug KB820656 kbAudDeveloper |
---|
|