Click here to Skip to main content
15,888,224 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have got five classes with common attributes e.g personal details, how do I place them into one class, so that, I don't get to duplicate them in all other classes?
Posted
Updated 15-Jul-10 23:50pm
v2

1 solution

You can create a base class with your common atributes from which other classes inherits.

Sample code:
<code>Public Class BaseClass


    Private _name As String
    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property



    Sub New()

    End Sub

End Class


Public Class People
    Inherits BaseClass

    Sub New()

    End Sub

End Class</code>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900