Instance Variables Inheritance

前端 未结 4 743
孤城傲影
孤城傲影 2021-02-12 17:08

Can someone explain how a class can access the instance variables of its superclass and how that is not inheritance? I\'m talking about \'The Ruby Programming Language\' and the

4条回答
  •  执念已碎
    2021-02-12 17:30

    It's confusingly worded. @x, @y, and @z are all instance variables on that Point3D instance. If that super(x,y) wasn't there, the Point3D instance would not have a @x or @y.

提交回复
热议问题