loading

The perfect choice of one-stop service for diversification of architecture.

What Is the Difference Between Implementing Interfaces and Class Inheritance

1. Make it versatile:

When a class inherits an abstract class, non abstract methods and attributes inherit, and the abstract method helps to implement them.

Class is like a modular machine when using the interface. If you install an audio interface, you have to do a power amplifier function inside. After the design, you have to have what functions according to what interface.

2. Structure:

An abstract class is more like a tree structure. The scope of an abstract class is the following subclasses, and there is no need to manage anything else.

The interface is more like an inter layer structure. The communication method between the upper layer and the lower layer is this interface. The upper layer can call according to the interface if it wants.

3. In terms of logic:

According to the logical order, the interface is generally designed first, and then the class is written. Because there are more classes, the abstract class is abstracted, which is convenient to write more classes.

The interface defines the functions of the class, and the abstract class abstracts the characteristics of some classes.

4. In terms of code writing:

Abstract classes improve the cohesion of classes and generic classes and reduce the amount of code.

The interface reduces the coupling between classes, but increases the amount of code.

What Is the Difference Between Implementing Interfaces and Class Inheritance 1

GET IN TOUCH WITH Us
recommended articles
Related Blogs blog
ADI's 16-bit, 10-msps SAR Analog-to-digital Converter
ADI's 16-bit, 10-msps SAR analog-to-digital converters exceed the industry performance standardsBeijing, China  (July 3, 2008) - analog devices, Inc. (N...
Analysis of Circuit Structure Schematic Diagram of Double Integral a / D Converter
1. Conversion modeV-T type indirect conversion ADC.two  circuit structure Fig. 1 is the principle circuit of this converter, which is composed of integr...
Problems of Phased Array Ground Penetrating Radar Detection System
Although GPR has been widely used in hydrology, engineering, environment and other fields, many basic theoretical and technical problems have not been fundamentally ...
Suggestions for Journaling, Bullet Notes, Activity, Wiki Like Application
So I am thinking of a possible answer to my own question:Build my own journal note entry app linked to a wiki.Zim Wiki uses a file based system for wiki. Maybe I cou...
How Many NCAA Football Bowls Are There?
About 8 I think1. where can i get ncaa football 10 rosters with names?For the last two years I got mine from "Pastapadre". From what i can tell they are really prett...
What Is the Name of a Horror Movie with an Eye Falling in a Cocktail Glass?
The Haunting I vaguely remember some kind of eye injury in the movie.• Other Related Knowledge ofa cocktail glass— â€&...
Automotive Backup Camera Systems, Backup Hub
rsync can be somewhat painful if you have a very large number of files - especially if your rsync version is lower than 3. On the other hand: if you use tar, you wou...
Blockchain Technology Explained: Powering Bitcoin
Blockchain Technology Explained: Powering BitcoinMicrosoft recently became the latest big name to officially associate with Bitcoin, the decentralized virtual curren...
PLEASE HELP ME CHOOSE a VIDEO CAMERA!?
PLEASE HELP ME CHOOSE A VIDEO CAMERA!?the Flip ultra HD is a really good HD portable camcorder, and it's fairly cheap. A lot of famous youtubers use it, such as timo...
The National Key R & D Plan Launched the Key Project of "key Technologies and Demonstration of Inter
In order to implement the tasks proposed in the outline of the national medium and long term science and technology development plan (2006-2020), the national key R ...
no data
Customer service
detect