1. New keyword:
1), creating objects
2), Hide members inherited from the parent class
What is object-oriented?
A way to analyze the problem (enhancing the scalability of the program)
Three main features of object-oriented: encapsulation, inheritance, polymorphism
Class? Object? What are the differences between classes and objects?
* Classes are molds that determine the characteristics (attributes) and behaviors (methods) that an object will have
* object is a concrete entity that you can see and touch---everything.
The class is the stencil that creates the object of the stencil, abstract.
1), class is a data type, user-defined data type
2), the composition of the class: Fields, properties, methods, constructors, etc.
The object is specific and is a concrete instance of the class. Objects have attributes (features) and methods (behaviors)
class contains class data (represented by fields) and behavior (represented by methods (functions, functions) as a piece of code with a name)
*this calling its own constructor for the current object display
*base calls the constructor of the parent class and calls the parent class's name method in the subclass
2. Access modifier:
Public: openly, publicly
Private: Accessible only within the current class, members of the class if no access modifier defaults to private
procteced: Protected, can be accessed inside the current class, or in subclasses of the class
Internal: Access modifiers that can be used to decorate classes are available in the current project only: internal and public
proctected internal:
3. Common key Words
This: The object of the current class calls its own constructor
Base: Calling a member of the parent class
NEW: Create object to hide members of parent class
Virtual: Mark a method as a virtual method
Abstract: An abstraction
Override: Override
Interface: interface
Partial: Partial Classes
Sealed: Seal class
Return: Returns the value returned in the method immediately ends this method
Break: Jump out of the current loop
Continue: End this cycle return to the loop condition to judge
Static: Statically
struct: Structure
Enum: enum
Const: constant
/// <summary> ///sealed sealed class, that he can not be inherited, but he can inherit others/// </summary> Public Sealed classTeacher {}/// <summary> ///The partial indicates that this class is part of the person class, essentially the following two classes are a class/// </summary> Public Partial classPerson {Private string_name; } Public Partial classPerson {Private int_age; }
. NET Learning notes----2015-07-21 (C # Basics Review 07, keywords, access modifiers)