But assuming the types are okay, the code path is chosen first by a polymorphic dispatch, and second by procedural switch.
但是假定类型没问题,那么代码路径首先由多态分派选中,其次由过程切换选中。
Your code can be more polymorphic — everything that responds to a method can be treated as one type — so you can often express ideas much more concisely than you can in other languages.
您的代码可以更加具有多态性——任何对一种类型的方法有反应的对象都可以看作这种类型——所以通常可以比其他语言更精简地表达思想。
Keeping up with your indexes, using eager loading with include, and using polymorphic associations in places instead of inheritance are just three ways you can use to improve your code base.
保留索引、借助include使用热加载和在某些地方使用多态关联代替继承是三种可用来改进代码库的方法。
Code is polymorphic when it gives different outputs for different kinds of inputs.
如果一段代码根据不同的输入给出不同的输出,那么它就具有多态性。
Code is polymorphic when it gives different outputs for different kinds of inputs.
如果一段代码根据不同的输入给出不同的输出,那么它就具有多态性。
应用推荐