gpt4 book ai didi

ruby - 如何查看某个类下或使用的所有类?

转载 作者:数据小太阳 更新时间:2023-10-29 07:17:53 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Look up all descendants of a class in Ruby

那么,假设我们有:

class LivingBeing
class Animal
end

class Bacteria
end

class Virus
end
end

class Fungi < LivingBeing
end

如何检查 LivingBeing 有哪些子类?我知道我们有 Klass.ancestors,但是查看祖先对立面的方法是什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com