Simple example:
class A
end
class B < A
end
Then, how can I judge whether class B is inherited from class A?
Is there a method somehow like is_a?
or maybe called is_child_of?
?
I can't find one.
You can use the <
operator:
B < A
will be true, if B is a subclass of A.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With