What is [interface]? ・ Has meanings such as boundary surface, contact point, liaison, bridge, etc. ・ The part where something comes into contact with something, or in between ・ One of the methods included in the class -Define only method types and variables -The specific processing content of the method is not described. -It is possible to describe the processing content just before using the method. -It is also possible to inherit multiple interfaces and create a new interface (it seems to be called multiple inheritance)
"Declaration" → interface Interface name {}
"Implementation" → class class name implements interface name {}
What is [abstract]? ・ Abstract: means abstract -A class that has one or more abstract methods -Methods that declare only definitions (method names, arguments, etc.) -Methods that do not describe specific processing details ・ Method can be overridden
"Abstract class" → abstract class class name {}
The advantage of abstract classes is
"By overriding an abstract method, it is possible to declare in advance" a method whose insertion location is not decided but will be needed in the future "at the time of implementation.
···It seems. I can only imagine softly with words, so I will make this area an issue.
Recommended Posts