Results 1 to 3 of 3
  1. #1
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Inheritance question

    Hi everyone,

    I have a question about inheritance.

    Here's my question: Is it possible for a subclass to inherit some or half of the attributes from the superclass? Because my lecture notes say that "A subclass must inherit all the superclass". Sorry if I asked a silly dumb question, I just want to clarify this.

    Thanks.

  2. #2
    kaydell2 is offline Senior Member
    Join Date
    Dec 2012
    Posts
    107
    Rep Power
    0

    Default Re: Inheritance question

    No, when you subclass, you inherit everything, though if things are private in the super-class, they won't be visible in the sub-class.

    Maybe you should split your super-class into more than one class.

  3. #3
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Re: Inheritance question

    Thank you for your input :D I get it now!

Similar Threads

  1. A question on Inheritance and fields
    By fatabass in forum New To Java
    Replies: 4
    Last Post: 12-16-2011, 08:39 PM
  2. inheritance question
    By Jaevko in forum New To Java
    Replies: 7
    Last Post: 08-31-2011, 07:30 AM
  3. Superclass and Inheritance question.
    By Dark in forum New To Java
    Replies: 6
    Last Post: 05-06-2011, 07:45 AM
  4. Question about inheritance
    By hei1233212000 in forum New To Java
    Replies: 3
    Last Post: 11-12-2010, 11:38 AM
  5. a question about inheritance
    By litojs in forum New To Java
    Replies: 8
    Last Post: 11-10-2008, 10:07 PM

Posting Permissions

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