Why can't reference to child Class object refer to the parent Class object?

后端 未结 14 1190
执念已碎
执念已碎 2020-12-17 10:50

I was explaining OOP to my friend. I was unable to answer this question. (How shameful of me? :( )

I just escaped by saying, since OOP depicts the real world. In rea

14条回答
  •  遥遥无期
    2020-12-17 11:32

    If it was valid, what would you expect when you read aChild.prop3? It is not defined on aParent.

提交回复
热议问题