. NET Learning notes----2015-07-21 (C # Basics Review 07, keywords, access modifiers)

Source: Internet
Author: User

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)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.