#Explain method chaining + inheritance
5 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @bleak orbit! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
<T extends X<T>> expects a type T that extends at some point X
You have the Pet class declared this way :
public class Pet<T extends Pet<T>>
The generic can only be a type that extends Pet, that Dog for example
public class Dog extends Pet<Dog>
However, this is not possible :
public class Dog extends Pet<String>
Because String does not extend Pet
It doesn't necessarily need to be done this way :
public class X extends T<X>
It could be
public class X extends T<Y>
and work as long as Y extends T
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.