Results 1 to 2 of 2

Thread: classes

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    1

    classes

    Looking for an simple explanation, with example or a website that illustrates this.

    1. Can a child class have multiple parents?

    2. Can multiple child classes have same parent?

    thanks

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    A child can have multiple parents only through several generations. In other words a child can only inherit from one parent at a time, but that parent can inherit from another as well. You can implement as many interfaces as you want though.

    VB Code:
    1. 'you can't inherit more than one at a time so this does NOT work
    2. Public Class Child
    3.   Inherits Parent1, Parent2
    4.  
    5. 'you can work around this like so
    6. Public Class Parent2
    7.   Inherits Parent1
    8.  
    9. Public Class Child
    10.   Inherits Parent2
    11. 'since parent2 inherits parent1 it has properties of both to pass on to Child

    Yes multiple child classes can have the same parent.
    VB Code:
    1. Public Class Child1
    2.   Inherits Parent
    3.  
    4. Public Class Child2
    5.   Inherits Parent
    6.  
    7. Public Class Child3
    8.   Inherits Parent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width