This is because B is not in the classpath of the system class loader or its parent or ancestor class loaders.
这是因为 B 不在系统类装入器或者它的双亲或祖先类装入器的类路径中。
That is, a call to obj.method() in a traditional OOP language will look through the method resolution order (MRO) of an object to find the "first" ancestor class of obj that has a method .method().
也就是说,在传统 OOP 语言中的 obj.method() 调用会通过对象的方法解析次序(method resolution order,MRO) 寻找 “第一个” 具有 .method() 方法的 obj 祖先类。
A subclass that implements a subtype does not override the behavior of its ancestor class; it only extends the services provided by that class.
具备子类型的子类不能覆盖其祖先类的行为,而只能扩展其祖先类提供的服务。
应用推荐