Concise Guide to Object-Oriented Programming by Kingsley Sage
Author:Kingsley Sage
Language: eng
Format: epub
ISBN: 9783030133047
Publisher: Springer International Publishing
We can now create some classes in Java to represent the super class Item and the three sub classes Vase , Statue and Painting . The keyword extends is used to indicate in Java that a class is a sub class of another:
If we create this as a project in BlueJ, we see the super and sub class relationship clearly on the central panel:
The Vase class has a total of four attributes. Two of these are unique to it, and two are “inherited ” from its superclass. Similarly, the Painting class has six attributes, four unique to it, and two inherited from its superclass
So a super, base or parent class contains a basic set of attributes that are intended to form a part of the implementation of sub classes that are built from it. The sub classes have their own attributes that make them unique, and they inherit attributes from their superclass. Similarly, a sub class inherits methods from its super class. If we add a method to the super class Item , we find that instances of Vase , Statue and Painting will inherit it, and be able to call those inherited methods as if they had been defined in their own class definitions. In our example, a showValue() method has been added to the Item super class. A new AntiqueShop class has been created, and that creates v1 , an object of type Vase , and v1 then calls the new showValue() method:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12555)
Hello! Python by Anthony Briggs(9904)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9785)
The Mikado Method by Ola Ellnestam Daniel Brolund(9769)
Dependency Injection in .NET by Mark Seemann(9329)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8282)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7756)
Grails in Action by Glen Smith Peter Ledbrook(7686)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7550)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7007)
Microservices with Go by Alexander Shuiskov(6774)
Practical Design Patterns for Java Developers by Miroslav Wengner(6684)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6629)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6399)
Angular Projects - Third Edition by Aristeidis Bampakos(6035)
The Art of Crafting User Stories by The Art of Crafting User Stories(5566)
NetSuite for Consultants - Second Edition by Peter Ries(5497)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5302)
Kotlin in Action by Dmitry Jemerov(5048)
