Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Teach me about inheritance and extends?

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Teach me about inheritance and extends?

    How does

    x is-a y
    x has-a y
    x wants-a y

    work?
    When do you use has-s in regards to X inherits Y, Y has a X or something like that?
    Last edited by tripline; November 26th, 2011 at 12:03 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,010
    Thanks
    52
    Thanked 2,276 Times in 2,247 Posts

    Default Re: Teach me about inheritance and extends?


  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Teach me about inheritance and extends?

    I need a little bit of help with contain.
    If x is-a y x inherits from y, but does this mean y contain x as well?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,010
    Thanks
    52
    Thanked 2,276 Times in 2,247 Posts

    Default Re: Teach me about inheritance and extends?

    What do your lessons and text book say?

    Can you write a simple program to show the problem you are having?

  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Teach me about inheritance and extends?

    Not a program just logic. For example
    X inherit y =x is a y
    how do i use this logic when it deals with has-a?
    x inherit y = y has a x? Is that how it works?

    And how would you use contain in an = expression?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,010
    Thanks
    52
    Thanked 2,276 Times in 2,247 Posts

    Default Re: Teach me about inheritance and extends?

    This is OOP theory. You'll get better answers for these questions from your textbooks or tutorials.

  7. #7
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Teach me about inheritance and extends?

    What does OOP stand for?

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,010
    Thanks
    52
    Thanked 2,276 Times in 2,247 Posts

    Default Re: Teach me about inheritance and extends?

    Is Google working where you are connected to the internet?
    Give it a try

Similar Threads

  1. Replies: 0
    Last Post: October 25th, 2011, 01:11 AM
  2. Interface and Extends problem
    By DannyGT in forum Object Oriented Programming
    Replies: 1
    Last Post: September 1st, 2011, 01:01 PM
  3. inheritance help
    By justin3492 in forum Object Oriented Programming
    Replies: 3
    Last Post: September 30th, 2010, 07:45 PM
  4. [SOLVED] Extends JPanel painting problem
    By Philip in forum What's Wrong With My Code?
    Replies: 3
    Last Post: July 28th, 2010, 03:16 PM
  5. keyword Extends
    By chronoz13 in forum Object Oriented Programming
    Replies: 3
    Last Post: November 27th, 2009, 06:30 AM