说我有这样的: class Bird{}
class PrettyBird extends Bird{}
class UglyBird extends Bird{}
class Duckling extends UglyBird{}
和我这样做: $bird = new Duckling();
OR $bird = new UglyBird();
假设在我的宇宙中所有我感兴趣的是
我觉得每次我提问这样的问题时,人们总是问代码,但是我发布了代码,没有人再次回应,因为我猜代码太长了。所以这次我会尽量简短。 考虑一个适配器类扩展此类,这对于扩大RecyclerViews提供的功能: public class MyAdapter extends ExpandableRecyclerViewAdapter<MyParentViewHolder, MyChildViewHolder>
我有一个抽象适配器类从外部库: public abstract class DragItemAdapter<T, VH extends DragItemAdapter.ViewHolder> extends RecyclerView.Adapter<VH> {
//Their other codes
public class ViewHolder extends Recycle
我很困惑这两种情况之间会有什么区别或性能增益。为什么要选择另一个呢? 父类: class exampleB
{
public function __construct($arg1, $arg2)
{
// Do something with the arguments.
}
}
儿童类A class exampleA extends example