(5) What is not inherited in sub class?
(a) Constructor (b) Method (c) Polymorphism (d) Super class
Answers
Answered by
2
(A)Static Methods and fields are not inherited too, when they are rewritten in subclasses, they just reuse the signature and hide the implementation of the method/field in the parent class. Constructors and static initializers and instance initializers. you can't inherit a private field,and constructor.
(a)In class-based object-oriented programming, a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
(b)1 : a procedure or process for attaining an object: such as. a(1) : a systematic procedure, technique, or mode of inquiry employed by or proper to a particular discipline or art. (2) : a systematic plan followed in presenting material for instruction the lecture method.
(c)Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
(d)A superclass is the class from which many subclasses can be created. The subclasses inherit the characteristics of a superclass. The superclass is also known as the parent class or base class. In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and Motorcycle
Answered by
1
Answer:
I Said No Spamming... Why Are You Spamming Can't You Read
Similar questions