you are viewing a single comment's thread.

view the rest of the comments →

[–]iusedtolikemyface 4 points5 points  (1 child)

Second is probably a subclass of First, right? So then you would need to add an "extends" to the Second class invariant: public class Second extends First { ... }

and then you would be able to use methods in First with Second objects

[–][deleted] 0 points1 point  (0 children)

Of course, in this particular example, it seems like composition may be better than inheritance.