Super Keyword Assignment Help

Assignment Help: >> Inheritance in Java - Super Keyword

Using 'super' keyword

Within the preceding examples, a classes derived from Box were not implemented as efficiently or as robustly as they could have been. For instance, the constructor for BoxWeight explicitly initializes the height, width and depth fields of Box ( ). Not only does this duplicate code found in its superclass, that is inefficient, but it implies in which a subclass must be granted access to   these members. Therefore, there will be times when you will need to create a superclass which keeps the details of its implementation to itself (that is, that keeps its data members private). In that case, there would be no encapsulation is a primary attribute of Object Oriented Programming; it is not surprising in which Java gives a solution to this problem. Whenever a subclass requires referring to its immediate supercalss, it could do so by use of the keyword super.

Super has two common forms. The first calls the superclass' constructor. Another is used to access a member of the superclass which has been hidden via a member of a subclass.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd