Exploring the Super Keyword and Casting Techniques
.jpeg)
Mastering Super keyword, Upcasting and Downcasting Everything You Need to Know ☝ Super keyword The super keyword is used to call the constructor of a superclass from a subclass. That is, it allows access to the members (methods, fields, constructors) of the parent class from within the subclass. Variables and methods can be called at any time via the super keyword. Unless one explicitly invokes the variables or methods of the super class using the super keyword, then nothing happens. Uses of super keyword Casting The term "casting" is commonly used to describe both implicit and explicit type conversions. Whether it's implicit casting or explicit casting, it's generally referred to as casting. The term “Type casting” specifically used when referring to casting objects from one class type to another, typically in the context of inheritance and polymorphism. There are two types of objects, parent object and child object. “Type casting” and “casting” refer to the sa...