in fact, in the study of C + + when there is contact about inheritance and other words, but, how. When young and ignorant, these words are like the wind of a
Like, blow a blow on the scattered ~
So, now re-contact, and then good to comb it (*-*). Hello studious we are still good friends.
During this part of the study, it took a whole night to swallowed the entire chapter. (Rookie level you know) and then silly.
Think that you have learned, just at this time. A "mentor lost friends" thick came. The stick to give a good pain, the baby is very wronged. He said, come on, you tell me.
What is polymorphic. I remember the time when the baby looked at a pile of things in his mind, but a word can not say the appearance. I mean, I just don't understand.
Completely, this thing touches me still very big. Because of their own learning is easy to enter a misunderstanding, you think you have mastered the good but often do not understand
The essence of it, so I can now understand why there are so many good-hearted people on the Internet to answer your questions. This is not only a channel for others, but also
It is the carding of their own knowledge to supplement. That's why I'm here. (Mamma Mia, it seems to run away ...) )
Inheritance of Classes
Syntax rules:
Class Subclass extends Parent class
Note: 1, the parent class type is public, protected, and default when the tragic inheritance.
2. In Java, subclasses can inherit only one parent class.
3. All Java classes are subclasses of object.
4. The Super keyword can be used to invoke the constructor method and member method of the parent class.
Polymorphism of the class
definition: Refers to the multiple states of a reference (type) under different circumstances.
Instance:
Animal an=new Cat (); Create an animal class and point to the Cat An.cry (); an=new Dog (); This animal also re-pointed to the dog an.cry ();
The result of running the instance is:
Cat Barking
The dog barks.
The same reference refers to animal an, which can redefine its point of reference. But this redefinition of the relationship must be a parent, the side of the system can not be referenced.
Abstract class
definition: A class defined with abstract is called an abstract class.
Grammar:
Public abstract class test{abstract void Testabstract (); Define abstract Methods}
Note Shixiang
This article is from the "11211583" blog, please be sure to keep this source http://11221583.blog.51cto.com/11211583/1763059
Java Learning Summary (ii) interfaces, inheritance, and polymorphism of classes