An advantage of inheritance is that: ( )
A: Objects of a subclass can be treated like objects of their superclass.
B: All methods can be inherited.
C: All instance variables can be uniformly accessed by subclasses and superclasses.
D: None of the above.
A: Objects of a subclass can be treated like objects of their superclass.
B: All methods can be inherited.
C: All instance variables can be uniformly accessed by subclasses and superclasses.
D: None of the above.
举一反三
- Which one of the following statements is wrong about inheritance? ( ) A: Inheritance is one of the features of OOP B: Protected members of a class can be inherited C: The inheriting class is called a subclass D: Private members of a class can be inherited and accessed
- Which of the following is false? ( ) A: A static method must be used to access private static instance variables. B: A static method can be accessed even when no objects of its class have been instantiated. C: A static method has no this reference. D: A static method can call instance methods directly.
- When we are introducing objects, presenting options and facts, and distinguishing between points, ideas, and facts, what gesture can we use? A: The “Chop”. B: The “Give”. C: The “Show”. D: None of the above.
- Working at a company ‘at will’: A: Means you have no long-term contract; B: Means you can contribute part of your salary (tax-free) to your will (inheritance); C: Is usually to the employee’s advantage; D: None of the above.
- The new module is versatile, because A: it can be a calculator B: it can send a fax C: it can play computer games D: all of the above