Superclass variable reference with subclass object

原创 2006年06月07日 14:35:00

A reference variable of a superclass can be assigned  a reference to any subclass derived from that superclass. You will find this aspect of inheritance quite useful in a variety of situations.

And it is important to understand that it is the type of the reference variable --- not the type of the object that it refers to----that determines what members can be accessed. That is, when a reference to a subclass object is assigned to a superclass reference variable, you will have access only to those parts of the object defined by the superclass.


超类与子类(Superclass & Subclass)

Q: 我看了WINX开发包中的文档中,你提到了超类,它是什么概念?我平常只听过子类(Subclass)。 A: 子类化(Subclass)是指替换窗口过程(WNDPROC)。     超类(Sup...

super 与 superclass subclass

super : 一个编译修饰符,表示用当前对象去调用父类的方法 superclass:获取调用者的父类 验证: 父类: #import @interface Per...

Hibernate Cannot use identity column key generation with <union-subclass> mapping for

今天学习Hibernate报一下错误:org.hibernate.MappingException: Cannot use identity column key generation with m...
  • yajing8
  • yajing8
  • 2017年02月17日 19:44
  • 311

重构手法31:Replace Type Code with Subclass (以子类取代类型码)

重构手法31:Replace Type Code with Subclass (以子类取代类型码)   你有一个不可变的类型码,它会影响类的行为。以子类取代这个类型码。 动机...

Variable 'X' is used before it has been assigned a value. A null reference exception could result at runtime.

         在自己做机房收费系统的过程中出现了这样的一个现象:如图                        str1 下面出现了一行波浪线.同时提醒自己错出现的错误.提示如下:  ...
  • jnqqls
  • jnqqls
  • 2011年05月07日 13:38
  • 1861

Caused by: java.lang.AssertionError: illegal type variable reference 解决办法

07-24 10:54:13.529: E/AndroidRuntime(12130): FATAL EXCEPTION: AsyncTask #3 07-24 10:54:13.529: E/And...

qmake Variable Reference

Home · All Classes · All Functions · Overviews [Previous: qmake Reference] [Contents] [Next...

Reference variable is not allocated memory

Here is a memory map; a representation of memory as a sequence of blocks:     address    01   02   ...

MT9V124 Register and Variable Reference

  • 2014年08月28日 15:18
  • 2.1MB
  • 下载
您举报文章:Superclass variable reference with subclass object