阅读背景:

是否可以在重写方法中使用专门的参数?

来源:互联网 

Let's say I have an abstract parent class called "shape", and that there are multiple subclasses (triangle, square, circle... ). I want to define an abstract method in the parent "shape" class which all subclasses must implement, let's call it "draw". So all shape subclasses must provide the "draw()" method. But, the draw method takes a parameter of type "Stencil", and, not every shape subclass can use just any stencil...Let's say I have an abstract parent class calle




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: