PackageCom.davperson;//Package Name Public classDemo117 { Public Static voidMain (string[] args) {pupil P1=Newpupil (); P1.printname (); }}//extract the student's common attributes and make a parent classclassstu{//Defining member Properties protected intAge ; PublicString name; Public floatfee; PrivateString job;//private will not be inherited//programming, if you don't want subclasses to inherit a property or method//you can declare it as p
Look at a piece of code: (Demo112.java), first understand why you want to use this./*the necessity of this*/ Public classdemo112{ Public Static voidMain (String []args) {Dog dog1=NewDog (2, "rhubarb"); Person P1=NewPerson (dog1,23, "just son"); Person P2=NewPerson (dog1,24, "Dragons"); P1.showinfo (); P1.dog.showInfo (); }}//Define a humanclassperson{//member Variables intAge ; String name; Dog Dog; // Reference type // Human tecto
1. Package DefinitionThe package must be the first statement in the Java source file:Package packagename;If the package statement is omitted, it is placed in the default package. The default package has no name. Packages are organized as DirectoriesIntroduce the class in the package: Import StatementThe Java. lang package is the core class library of the Java lan
return type cannot be used to differentiate the overloading.4. ConstructorThe constructor is used to create an object and complete initialization.1) The name is exactly the same as the class name2) No response type, and no void3) There can be multiple constructor methods or no Constructor (with the default constructor)5. Main MethodPublic static voidmain (string ARGs []){//.....}Except that the method parameter name ARGs can be changed, the items her
What is itBefore describing the difference and pros and cons, briefly introduce both.Functional programming, as the name suggests, this kind of programming is the function of thinking as the core, in this thinking angle to think about the problem. The most important foundation of this programming is the lambda calculus, which accepts functions as inputs and outpu
1. polymorphic ConceptPolymorphism is the embodiment of multiple forms of objects. For example, we say "pet" This object, it has a lot of different expression or implementation, such as a kitten, puppies, lizards and so on. So I went to the pet shop and said, "Please give me a pet," the waiter gives me a kitten, a puppy or a lizard, and we say that the object of "pet" is polymorphic.Polymorphism in
code in the new type of book to solve the requirements (the code that solves the problem is written in the newly created class and can be used directly if you encounter similar requirements later). Using an object-oriented approach to solve problems in development, you can convert a developer from a contributor (worker) to a caller (the conductor)
This keyword is a flexible and complex syntax in the Java language. It is also listed separately as a string.
Use environment of this keyword:
1. You can call methods in this class.
This method can make the general methods in the class or the constructor.
You have already met the call of common methods before. You can use this. function () directly.
Note the need to use the this keyword in the constructor. In the constructor,Using the this ()
Detailed description of object generation methods for PHP object-oriented programming, and detailed description of python Object-Oriented Programming
This article describes the
Details about JS Object-Oriented Programming and js Object-Oriented Programming
Because JavaScript is based on prototype, and there is no class concept (ES6 has it, so we will not talk about it for the time being), we can access a
JavaScript and Java, C # and other languages also have some object-oriented features, but in fine comparison, it will be found that these features are not real object-oriented, many places are using the object itself to simulate
prototype methods are added to the sub-class.Instance1.colors.push (' black '); Console.log (instance1.colors); // [' Red ', ' blue ', ' green ', ' black '] // [' Red ', ' blue ', ' green ']instance1.getname (); // CSSbook instance2.gettime (); // -Note: A subclass that wants to add a prototype method must pass a prototype object, one way to add it through the form of a point syntax, or it will be directly assigned to an
attributes in the class.8. Through the object view, data in a data table can be directly returned as a class object.What Is Object-Oriented Programming?
Object-Oriented Programming (OO
Summary of Python object-oriented programming knowledge points, python Object-Oriented Programming
Preface
If you have never been familiar with object-
PHP Object-oriented programming (a), PHP object-oriented programming (
Class-To-object relationships:
The class is like a human colony. We instantiate an
, using JavaScript to write the front end, back end and script. At the React.js 2015 conference, Facebook unveiled the forthcoming open source react Native, which means we can use JavaScript to write native apps for iOS and Android in the future, which is true learn-once, write-anywhere . I believe that with the release of ECMAScript 6, JavaScript will have a series of changes in the language, stay Tuned. :-)Reference
Javascript. The core
"Javascript:the Good Parts" strongly recomme
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.