How do I call a super class method

前端 未结 5 819
栀梦
栀梦 2020-12-24 01:44

I have two classes A, and B. Class B overrides the foo method of class A. Class B has a b

5条回答
  •  旧巷少年郎
    2020-12-24 02:22

    You can alias old_foo foo before redefining it to keep the old implementation around under a new name. (Technically it is possible to take a superclass's implementation and bind it to an instance of a subclass, but it's hacky, not at all idiomatic and probably pretty slow in most implementation to boot.)

提交回复
热议问题