I want masterclass.subclass.function to work ( need easy way to exposing a subclass?)

this probably has a simple answer

I want to create a class library that has itself some sub classes, which in turn have functions.

I mostly want to do this so that the functionality that is being developed for one county in a state to be contained in  a single manageble class.

I want the classes to contain instructions specific to that county, and I expose these as public functions.

Now what I want is to take the classes for each county and put them under a class library for the whole state.

For instance, say I have a class library for colorado, I want to then be able to refrence that colorado class library in another application like this:

ColoradoJobLibrary.CoArapahoeJobs.dosomething

so ColoradoJobLibrary is one object, but then CoArpahoeJobs is another object and dosomething is a function in coArapahoeJobs

I suspect that inheritace, interfaces or imports has something to do with this, but can't quite figure out how to expose the subclass through another class without having to write a property  or function for each function in the county class in the state class.  Is there an easier way?


LVL 2
tmesiasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

samtran0331Commented:
If you had this in a class file:

Namespace States

    Public Class ColoradoJobLibrary
        Public Class CoArapahoeJobs
            Public Shared Function dosomething() As String
                Return "Hey"
            End Function
        End Class
    End Class

End Namespace


you can then use it on a page by:
Imports YourProjectName.States

and then in page_load you can:
            Response.Write(States.ColoradoJobLibrary.CoArapahoeJobs.dosomething)


of course, you can play with the nesting of classes and/or add more namespaces to 'expose' things the way you want.
tmesiasAuthor Commented:
Thank you for your reply,

We got the right idea of how I want to be able to refer it but I don't want to write this:

Namespace States

    Public Class ColoradoJobLibrary
        Public Class CoArapahoeJobs
            Public Shared Function dosomething() As String
                Return "Hey"
            End Function
        End Class

        Public Class CoDenverJobs
            Public Shared Function dosomethingelse() As String
                Return "Hey from denver"
            End Function
        End Class
    End Class

End Namespace

I want coDenverJobs and coArapahoeJobs to be different cls files (so I can divide the work of creating them).

samtran0331Commented:
...gotcha...

class1.vb file:
Namespace ColoradoJobLibrary

    Public Class coArapahoeJobs
        Public Shared Function dosomething() As String
            Return "Hey Arapahoe!"
        End Function
    End Class

End Namespace


class2.vb file:
Namespace ColoradoJobLibrary

    Public Class coDenverJobs
        Public Shared Function dosomething() As String
            Return "Hey Denver!"
        End Function
    End Class

End Namespace

From a page:
Imports yourProjectName.ColoradoJobLibrary

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Me.IsPostBack Then
            Response.Write(ColoradoJobLibrary.CoArapahoeJobs.dosomething)
            Response.Write(ColoradoJobLibrary.coDenverJobs.dosomething)
        End If
    End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmesiasAuthor Commented:
thanks that's what I was looking for.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.