Polymorphism Question

Discussion in 'OT Technology' started by morgue, Sep 18, 2006.

  1. morgue

    morgue New Member

    Joined:
    Jul 10, 2004
    Messages:
    8,278
    Likes Received:
    0
    I have to do this for my homework and I know about the do-it-yourself policy in OT and I agree with it but I can't think of something else... Anway... Here's the question:

    [FONT=&quot][/FONT]Discuss four ways in which you can assign superclass and subclass references to variables of superclass and subclass types.

    Solution:
    1. Assign superclass reference to superclass object.
    Create a superclass object and assign its reference to a variable of superclass type.
    2. Assign subclass reference to subclass object.
    Create a subclass object and assign its reference to variable of subclass type.
    3. Assign superclass reference to subclass object.
    Create subclass object and assign its reference to a variable of superclass type.

    What other way can you use to do that? Thx!
     
  2. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
  3. morgue

    morgue New Member

    Joined:
    Jul 10, 2004
    Messages:
    8,278
    Likes Received:
    0
    The thing is Java doesn't support Multiple Inheritance
     

Share This Page