Before the Exam Tomorrow

6 views
Skip to first unread message

Jimmer Fredette

unread,
Jul 29, 2011, 1:48:34 AM7/29/11
to BYU 142 Summer 2011
If anyone wants to fill me in on this. I was a little foggy on the
concept of inheritance the other day.

I remember us saying that a child class cannot have two fathers. So it
must come from a certain class and can only relate to it in this
certain way. So my main question is this:

If I had two classes:

public class BestBasketballPlayersInTheNCAA() {}
public class JimmerFredette(){}

Which would be the father? Where would I put the extends to say who
gets traits from who? Very confused. It's causing an infinite loop of
introspection and my motherboard is about to fry.

Sarah Morley

unread,
Jul 29, 2011, 3:44:36 PM7/29/11
to byu-142-s...@googlegroups.com
JimmerFredette is a BestBasketballPlayersInTheNCAA, so he would extend that class:

public class JimmerFredette extends BestBasketballPlayersInTheNCAA
{
}

or if BestBasketballPlayersInTheNCAA was an interface, then you'd implement it:

public class JimmerFredette implements BestBasketballPlayersInTheNCAA
{
}

It wouldn't make sense to say BestBasketballPlayersInTheNCAA is a Jimmer Fredette. I imagine this could be applied to many different classes:

public class JacksonEmery extends BestBasketballPlayersInTheNCAA
{
}

public class NoahHartsock extends BestBasketballPlayersInTheNCAA
{
}

etc...

Sarah
Reply all
Reply to author
Forward
0 new messages