In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, Xiaobian will bring you ideas about what OOP is. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
OOP idea refers to object-oriented programming, object-oriented emphasizes the "abstraction","encapsulation","inheritance" and "polymorphism" of objects. Compared with process-oriented idea, OOP idea focuses on solving problems through some methods of objects, and different functions may be solved by different objects.
classes and objects
Class: class is an abstract concept, is a class of things with the same characteristics collectively, such as college students;
Object: Object is the entity of concrete things, such as concrete students Zhang San.
Three characteristics of object-oriented
1. Encapsulation
Encapsulation means that a class can have some private properties and methods, and can encapsulate the solution to a problem, providing only a part of the interface to the outside world. The problem can be solved by calling the interface, but the outside does not know what the specific solution is.
2. Inheritance
A class can inherit non-private properties and methods from another class so that inherited properties and methods can be reused.
3. Polymorphism
Child objects instantiated from the same parent class can get different results by calling the same method. This is polymorphism.
Seven Design Principles
SOLID principles
Single Responsibility Principle: Only one class/interface/method can have one and only one responsibility.
Open-close principle: open to expansion, closed to modification;
Richter substitution principle: all references to base classes must be transparent to the use of objects of their derived classes;
Interface isolation principle: users should not be forced to rely on interfaces they do not use, using multiple interfaces is better than using a total interface;
Dependency inversion principle:
High-level modules should not depend on low-level modules, both should depend on abstractions.
B. Abstractions should not depend on details, details should depend on abstractions C. Programming for interfaces, not programming for implementations
Dimitri's Law: A software entity should interact with other entities as little as possible
Composition reuse principle: try to use composition/aggregation, do not use class inheritance
The above is what Xiaobian shared for everyone is OOP thought, if there is a similar doubt, may wish to refer to the above analysis to understand. If you want to know more about it, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.