c# .net

C# object-oriented

C# object-oriented, someone asked me to explain?

c# object Oriented

First, the object-oriented (OOP) 
process 
-oriented process is to analyze the steps required to solve the problem, and then each step uses the function implementation, the function is called in turn, the C language object-oriented. 
object: the real thing in life (computer, mobile phone, grass, tree...) 
Object-oriented is the decomposition of the things that make up the problem into individual objects. The purpose of creating an object is not to complete the steps, but to describe an object in the entire problem-solving step. Behavior (function) 
c# java 
wash clothes: 
face-oriented process: 
1, open the washing machine cover 
2, put the clothes into the 
3, introduce the washing powder 
4, click start 
5, dry clothes 
6..... 
object-oriented: 
clothes (washed ), washing machine (washing), washing powder (to stain) 
car: 
facing the process: 
1, how to start 
2, how to accelerate 
3, how to brake 
the object: 
1, whether the relationship has the function of starting, acceleration, braking, etc 
.: 
process-oriented: the specific implementation of each step of the value, the more detail-oriented 
object-oriented: Object saw what features do not function relationship of each concrete realization 
Second, the object-oriented Zheng 
encapsulation, inheritance, polymorphism, abstract 
three classes and objects
Class: type, human, computer, aircraft, automobile, animal..... 
human: 
characteristics: two hands and two feet, one head, one pair of eyes, can go, can eat, can sleep, can learn, can Work.... 
Anything with the above characteristics can be called human, and that thing is the object of programming, such as: you 
object: things with attributes and behaviors are called object 
classes: things with the same attributes and behaviors The collection is called a class 
problem: Is a class a concrete thing? No, the class is just an abstract conceptual 
class. The object 
class is the abstraction of the object. The object is the concrete class. 
When a class is not enough to describe an object, the class is an abstract class. For example: graphics 
problem: the class is the template of the object. ? Yes, for example: 
the main characteristics of the mold object-oriented, design: class 
four, class definition 
modifier class class name 

class members: attributes and methods 
}
modifier: 
public: public, access without permissions limit 
internal: internal, own The assembly in which it is located can be accessed.  
Note: When we do not display the specified modifier, the default internal 
property: variable, constant 
method: 
access modifier return type method name (parameter list) 



instantiated object: 
class name object name = new class Name (); 
object name. attribute;
Object name. method(); 
member variable and member method modifier: 
public: public, access is not restricted 
internal: internal, your own assembly can access 
protected: protected, your own class and its subclasses Can access (inherit) 
private: private, you can access 
Note: 
If you do not display the declaration modifier, the default private 
permission size: public > internal > protected > private 
Usually: the class uses public, member variables use private, member methods use public 
naming Specification: 
1. The class name is capitalized at the beginning 
2. The member variable 
in the class begins with a lowercase 3. The method name in the class begins with 
five. The package 
life: express, computer, air conditioner.... can not see the internal implementation, provide external interface , button, the user does not care about the internal implementation, know how to use it in the 
program: member variables use private decoration, provide attribute declaration 
attribute declaration: 
modifier data type attribute name 

get{return attribute } 
set { attribute = value} 

usually Is provided for use by outside classes, often using public modifiers for security

Post your comments / questions