Abstract: Fuzzy = = Can not understand
Inheritance: Discovering commonalities between things and extracting them upward to improve code reusability
Things have this function, but this function is what, how to do, do not know, this involves the abstract
1, inheritance: A, b two classes, have show function, the implementation of the same way you can then extract its generality, make a new class, so that a A, a, a, a and a new class.
2, Abstract: A,b two classes, have the function of show, but the implementation of the function is not the same, then the method to extract upward, but the content is not the same , then use the keyword abstract identification, representing the abstract function, Then this class must also be marked with an abstract, representing an abstraction class
Abstract class c{abstract void Show ();} Class A extends C{void show () {System.out.println ("A");}} Class B extends C{void show () {System.out.println ("B");}}
Dogs and wolves bark, they all belong to the canine family, and the canine family has a bark function.
As a kind of thing, they all have a function of barking, but how to make sure, this method teaches abstraction.
When a class describes a thing, there is not enough information to describe the thing, and this class is abstract.
Abstract class Canine {abstract void sing ();//four legs, two eyes, running, jumping ...} Class Dog extends {void sing () {System.out.println ("screaming Babies");} 。。。。 }class Wolf extends Canine {void Show () {System.out.println ("barking");} 。。。 }
Ps:java Support multi-language, gray often powerful, development disabled
Continue tomorrow ...
Java Learning Lesson 13th (under Inheritance: Abstract class abstraction)