#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Question VB.NET class reference question


    Trying to create class structure that does not declare everything public. I would like CFamily to declare Father, Mother, and Child as CPerson. Father, Mother and Child can reference CPerson's First, Middle and Last names.

    I would like to limit the list of properties displayed in intellisence.

    Friend Class CPerson
    Private mFirstName As String
    Private mMiddleName As String
    Private mLastName As String


    Public Property Firstname() As String
    Get
    Firstname = mFirstName
    End Get
    Set(ByVal Value As String)
    mFirstName = Value
    End Set
    End Property

    Public Property MiddleName() As String
    Get
    MiddleName = mMiddleName
    End Get
    Set(ByVal Value As String)
    mMiddleName = Value
    End Set
    End Property

    Public Property LastName() As String
    Get
    LastName = mLastName
    End Get
    Set(ByVal Value As String)
    mLastName = Value
    End Set
    End Property

    End Class

    Public Class CFamily

    Private oMother As New CPerson()
    Private oFather As New CPerson()
    Private oChild As New CPerson()

    'Your help is appreciated!!

    Public Mother as oMother
    Get
    End Get
    Set(ByVal Value As String)
    End Set
    End Property

    Public Father as oFather
    Get
    End Get
    Set(ByVal Value As String)
    End Set
    End Property

    Public Child as oChild
    Get
    End Get
    Set(ByVal Value As String)
    End Set
    End Property
    End Class
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    2
    Rep Power
    0

    Cool Solution


    The problem was been solved

    Public Class Family
    Private oMother As IMother
    Private oFather As IFather
    Public Property Mother() As IMother
    Get
    Mother = oMother
    End Get
    Set(ByVal Value As IMother)
    oMother = Value
    End Set
    End Property
    Public Property Father() As IFather
    Get
    Father = oFather
    End Get
    Set(ByVal Value As IFather)
    oFather = Value
    End Set
    End Property
    Public Sub New()
    oMother = New CMother
    oFather = New CFather
    End Sub
    Protected Class CMother
    Inherits Person
    Implements IMother
    Dim boolPregnant As Boolean
    Property Pregnant() As Boolean Implements IMother.Pregnant
    Get
    Pregnant = boolPregnant
    End Get
    Set(ByVal Value As Boolean)
    boolPregnant = Value
    End Set
    End Property
    End Class
    Protected Class CFather
    Inherits Person
    Implements IFather
    Dim boolCastrated As Boolean
    Property Castrated() As Boolean Implements IFather.Castrated
    Get
    Castrated = boolCastrated
    End Get
    Set(ByVal Value As Boolean)
    boolCastrated = Value
    End Set
    End Property

    End Class

    End Class
    Public Interface IPerson
    Property LastName() As String
    End Interface
    Public Interface IMother
    Inherits IPerson
    Property Pregnant() As Boolean
    End Interface
    Public Interface IFather
    Inherits IPerson
    Property Castrated() As Boolean
    End Interface
    Public MustInherit Class Person
    Implements IPerson
    Public Property LastName() As String Implements IPerson.LastName
    Get

    End Get
    Set(ByVal Value As String)

    End Set
    End Property
    End Class

IMN logo majestic logo threadwatch logo seochat tools logo