DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Don Brown Guest

    Class1 with a member of type Class2


    I am trying to rework some of my classes and I may be trying to do something
    that is not possible in VB. I may need to pop out to C++ to create a DLL
    of my classes, then use that DLL in VB, but I'd rather not if I don't have
    to.

    I want to create a Class, CWidget that has a member function "Settings" of
    type CSettings

    I'm thinking of using it in my project as
    Widget.Settings.Flag1=True

    I may need to use the Implements keyword, but everywhere I look for examples
    and explainations all I can find are Inherited classes like "Animal" and
    "Dog", where Dog Implements Animal and you must put Animal's interface into
    Dog's .cls file.

    Here are snippets of what I am thinking...

    Class CWidget
    Private Length as Integer
    Private Width as Integer
    Private Settings as CSettings
    ...
    Private Sub CWidget_Initialize()
    Set Settings = New CSettings
    End Sub


    Class CSettings:
    Private Flag1 as Boolean
    Private Flag2 as Boolean
    ...


    Any help you can offer would be greatly appreciated.

    Don Brown
    donb@unitepentek.com
    317-351-4413

  2. #2
    Jonathan Wood Guest

    Re: Class1 with a member of type Class2

    Why can't you just do like this in your CWidget class:

    Public Settings As New CSettings

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com
    "Don Brown" <donb@unitedpentek.com> wrote in message
    news:3abb9a21$1@news.devx.com...
    >
    > I am trying to rework some of my classes and I may be trying to do

    something
    > that is not possible in VB. I may need to pop out to C++ to create a DLL
    > of my classes, then use that DLL in VB, but I'd rather not if I don't have
    > to.
    >
    > I want to create a Class, CWidget that has a member function "Settings" of
    > type CSettings
    >
    > I'm thinking of using it in my project as
    > Widget.Settings.Flag1=True
    >
    > I may need to use the Implements keyword, but everywhere I look for

    examples
    > and explainations all I can find are Inherited classes like "Animal" and
    > "Dog", where Dog Implements Animal and you must put Animal's interface

    into
    > Dog's .cls file.
    >
    > Here are snippets of what I am thinking...
    >
    > Class CWidget
    > Private Length as Integer
    > Private Width as Integer
    > Private Settings as CSettings
    > ..
    > Private Sub CWidget_Initialize()
    > Set Settings = New CSettings
    > End Sub
    >
    >
    > Class CSettings:
    > Private Flag1 as Boolean
    > Private Flag2 as Boolean
    > ..
    >
    >
    > Any help you can offer would be greatly appreciated.
    >
    > Don Brown
    > donb@unitepentek.com
    > 317-351-4413




  3. #3
    Jonathan Wood Guest

    Re: Class1 with a member of type Class2

    Why can't you just do like this in your CWidget class:

    Public Settings As New CSettings

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com
    "Don Brown" <donb@unitedpentek.com> wrote in message
    news:3abb9a21$1@news.devx.com...
    >
    > I am trying to rework some of my classes and I may be trying to do

    something
    > that is not possible in VB. I may need to pop out to C++ to create a DLL
    > of my classes, then use that DLL in VB, but I'd rather not if I don't have
    > to.
    >
    > I want to create a Class, CWidget that has a member function "Settings" of
    > type CSettings
    >
    > I'm thinking of using it in my project as
    > Widget.Settings.Flag1=True
    >
    > I may need to use the Implements keyword, but everywhere I look for

    examples
    > and explainations all I can find are Inherited classes like "Animal" and
    > "Dog", where Dog Implements Animal and you must put Animal's interface

    into
    > Dog's .cls file.
    >
    > Here are snippets of what I am thinking...
    >
    > Class CWidget
    > Private Length as Integer
    > Private Width as Integer
    > Private Settings as CSettings
    > ..
    > Private Sub CWidget_Initialize()
    > Set Settings = New CSettings
    > End Sub
    >
    >
    > Class CSettings:
    > Private Flag1 as Boolean
    > Private Flag2 as Boolean
    > ..
    >
    >
    > Any help you can offer would be greatly appreciated.
    >
    > Don Brown
    > donb@unitepentek.com
    > 317-351-4413




  4. #4
    Bob Rouse Guest

    Re: Class1 with a member of type Class2


    Something like this is pretty standard:

    <Within CWidget>:

    Private Settings as CSettings

    Private Sub CWidget_Initialize()
    Set objSettings = New CSettings
    End Sub

    Public Property Get Settings() as CSettings
    Set Settings = objSettings
    End Property

    Public Property Set Settings(objNewSettings as CSettings)
    Set objSettings = objNewSettings
    End Property

    >>

    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >Why can't you just do like this in your CWidget class:
    >
    >Public Settings As New CSettings
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >"Don Brown" <donb@unitedpentek.com> wrote in message
    >news:3abb9a21$1@news.devx.com...
    >>
    >> I am trying to rework some of my classes and I may be trying to do

    >something
    >> that is not possible in VB. I may need to pop out to C++ to create a DLL
    >> of my classes, then use that DLL in VB, but I'd rather not if I don't

    have
    >> to.
    >>
    >> I want to create a Class, CWidget that has a member function "Settings"

    of
    >> type CSettings
    >>
    >> I'm thinking of using it in my project as
    >> Widget.Settings.Flag1=True
    >>
    >> I may need to use the Implements keyword, but everywhere I look for

    >examples
    >> and explainations all I can find are Inherited classes like "Animal" and
    >> "Dog", where Dog Implements Animal and you must put Animal's interface

    >into
    >> Dog's .cls file.
    >>
    >> Here are snippets of what I am thinking...
    >>
    >> Class CWidget
    >> Private Length as Integer
    >> Private Width as Integer
    >> Private Settings as CSettings
    >> ..
    >> Private Sub CWidget_Initialize()
    >> Set Settings = New CSettings
    >> End Sub
    >>
    >>
    >> Class CSettings:
    >> Private Flag1 as Boolean
    >> Private Flag2 as Boolean
    >> ..
    >>
    >>
    >> Any help you can offer would be greatly appreciated.
    >>
    >> Don Brown
    >> donb@unitepentek.com
    >> 317-351-4413

    >
    >



  5. #5
    Bob Rouse Guest

    Re: Class1 with a member of type Class2


    Something like this is pretty standard:

    <Within CWidget>:

    Private Settings as CSettings

    Private Sub CWidget_Initialize()
    Set objSettings = New CSettings
    End Sub

    Public Property Get Settings() as CSettings
    Set Settings = objSettings
    End Property

    Public Property Set Settings(objNewSettings as CSettings)
    Set objSettings = objNewSettings
    End Property

    >>

    "Jonathan Wood" <jwood@softcircuits.com> wrote:
    >Why can't you just do like this in your CWidget class:
    >
    >Public Settings As New CSettings
    >
    >--
    >Jonathan Wood
    >SoftCircuits Programming
    >http://www.softcircuits.com
    >"Don Brown" <donb@unitedpentek.com> wrote in message
    >news:3abb9a21$1@news.devx.com...
    >>
    >> I am trying to rework some of my classes and I may be trying to do

    >something
    >> that is not possible in VB. I may need to pop out to C++ to create a DLL
    >> of my classes, then use that DLL in VB, but I'd rather not if I don't

    have
    >> to.
    >>
    >> I want to create a Class, CWidget that has a member function "Settings"

    of
    >> type CSettings
    >>
    >> I'm thinking of using it in my project as
    >> Widget.Settings.Flag1=True
    >>
    >> I may need to use the Implements keyword, but everywhere I look for

    >examples
    >> and explainations all I can find are Inherited classes like "Animal" and
    >> "Dog", where Dog Implements Animal and you must put Animal's interface

    >into
    >> Dog's .cls file.
    >>
    >> Here are snippets of what I am thinking...
    >>
    >> Class CWidget
    >> Private Length as Integer
    >> Private Width as Integer
    >> Private Settings as CSettings
    >> ..
    >> Private Sub CWidget_Initialize()
    >> Set Settings = New CSettings
    >> End Sub
    >>
    >>
    >> Class CSettings:
    >> Private Flag1 as Boolean
    >> Private Flag2 as Boolean
    >> ..
    >>
    >>
    >> Any help you can offer would be greatly appreciated.
    >>
    >> Don Brown
    >> donb@unitepentek.com
    >> 317-351-4413

    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links