Creating object with reference to Interface

后端 未结 6 859
自闭症患者
自闭症患者 2021-02-04 22:08

A reference variable can be declared as a class type or an interface type.If the variable is declared as an interface type, it can reference any object of any class that impleme

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 22:36

    You need to type cast it to get the access to the Parent methods

    ((Parent)objParent).displayName();
    

提交回复
热议问题