#Inheritance
1 messages · Page 1 of 1 (latest)
note we wont do your homework, you got any specific question about this in order to solve it yourself
lets start with the first:
m = t; // legal
what does this mean for class M and class T
M is Parentclass of T
its useful for this for example:
m = t;
o = t;
means that T is a subclass of M and O, the question now is if M extends O or if O extends M
and therefore you use the illegal statement:
o = m; // illegal
which means that O extends M
so you get T -> O -> M
if you have a question about that just ask
I would then say: Class M is a superclass of classes O and X. Class T is a subclass of class O
Right?
he wrong on that though
didnt know chatgpt was a guy
what did he say?
Chatgpt: "In summary, M could be a common superclass of T and X, while O is independent of the other classes or has a common superclass with T."
did you specify its about java
Yes
because some languages have multiple inheritance
I am pretty sure this is correct
but maybe wait for someone else to verify
Okay, thank you very much
if o had a common superclass with t, then o = t would be illegal, since t wouldnt derive from o (unless they're talking about the o -> t -> m relationship. o = t only works if t is a subtype of o
meant to reply to this post
pretty sure squid is correct
Okay thank you
wait
o = m being illegal means that M does not inherit from O
it does not mean that O inherits from M
it doesn't imply it or anything, it just means that M doesn't inherit from O
i came up with this solution from another server he asked the question on
(solution deleted because i'm stupid as hell)
if you only talk about extends (abstract classes), then it must be the case
no
yes
with interfaces, that works
but they cant be interfaces based on how they're created
smart
yeah but all those are classes
yeah so O has to extend M for that to work
since M cant extend O, that's given
yeah that makes more sense
yeah 
god it is too late for me to be doing this shit
disregard fucking everything i said
all good
no its not all good, i am hired to be a java dev. i shouldnt have these issues
gdi
nah this can happen, you just focused on the legal/illegal stuff and overlooked the source code given
happens to all of us, dont beat yourself up too much