Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   Inheritance Blues (http://www.programmingforums.org/showthread.php?t=12621)

melwinator20 Feb 19th, 2007 6:10 AM

Inheritance Blues
 
I have a problem for which I dont seem to be getting a solution.

I have 3 projects namely Project A,B and C.

In projectA, I have defined a public class ClassA

:


Public Class ClassA
    Public Shared Function ClassAFunction() As String

        Return "Class A"

    End Function


End Class


In ProjectB, I have inherited from the ClassA in ProjectA.

:

Imports ProjectA
Public Class ClassB
    Inherits ProjectA.ClassA

    Public Shared Function ClassBFunction() As String
        Return "Class B"
    End Function


End Class


In ProjectC, I have given a reference to ProjectB.

I am able to access the function present in ClassB but not the functions inherited from ClassA.

eg: ClassB.ClassBFunction() ----- allowed
ClassB.ClassAFunction() ----- not allowed.

But if I overload the ClassAFunction within ClassA, then it is accessible.
eg: ClassB.ClassAFunction() ---- allowed

Could anyone tell me the reason

dr.p Feb 19th, 2007 8:59 AM

VB Docs read thusly:
:

Friend Class BaseClass
    Public Sub BaseMethod()
        ' Add code here to define BaseMethod.
    End Sub
End Class

Friend Class DerivedClass
    Inherits BaseClass
        ' Gets BaseMethod from friendly parent
End Class



All times are GMT -5. The time now is 10:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC