public interface ICloneable<out T> : ICloneable new T Clone();现在,我在一个基类中实现了这个接口。我创建了一个派生的Base类,它再次实现了接口ICloneable<T>,以返回这个新类型:{ }但是,如果我对Clone()实例调用Sub,就会遇到一个StackOverflowException,因
对于返回类型,返回值的协方差是Liskov Substitiution原则所要求的。让我们假设返回类型的小类型层次结构:class D : public B {};class Base {};class Derived : public Base {};
这将符合LSP,因为返回类型是协变的( Base和Derived的层次结构是B<
在我的代码中,我定义了以下变量,给出警告This class shouldn't be used in Kotlin.Use kotlin.Any instead
因此,我需要知道--与kotlin中的对象类似,还是其他什么东西?还需要知道wait()、notify()等方法在对象类中是可用的,但在任何类中都是不可用的,所以在kotlin中执行该操作?