Discuss three proper ways in which you can assign superclass and subclass references to vari- ables of superclass and subclass types.
What will be an ideal response?
1) Assigning a superclass reference to a superclass variable. 2) Assigning a subclass ref- erence to a subclass variable. 3) Assigning a subclass object’s reference to a superclass variable is safe, because the subclass object is an object of its superclass. However, this reference can be used to refer only to superclass members. If this code refers to sub- class-only members through the superclass variable, the compiler reports errors.
Computer Science & Information Technology
You might also like to view...
CompuServe was a large commercial dial-up computer network, in operation from 1979 through 2009
Indicate whether the statement is true or false
Computer Science & Information Technology
Where would you go to enable a SATA port?
A) CMOS B) BIOS C) Disk Management tool D) Task Manager
Computer Science & Information Technology