6.17 outline of object-oriented ideas and classes

Source: Internet
Author: User

C # review:

Problem:

Add 5 Student information to the collection,

Each student has: study number, name, score, 3 content,

The students ' scores are arranged from high to low and printed out after the completion of the addition.

Object Oriented thinking:

All things are objects

Object-oriented three major features:

Package: Package equivalent to the protection of the constraints, the stars are economic people, to see the star must first go through the broker's review.

Inheritance: Objects are hierarchically arranged, the next level can inherit the previous urgent attribute, but the upper level can choose to reject the next level of inheritance.

Polymorphism: The same attribute on the previous level, different next-level usage, such as white roses, can be sent to a lover, can also be sent to the hospital to visit the patient.

Classes class:-------------------------------------------

Package: Package equivalent to the protection of the constraints, the stars are economic people, to see the star must first go through the broker's review.

Member variables: member variables are equivalent to stars. Private string _mingxing

Properties: The encapsulated content is called an attribute, and the property is equivalent to a broker. Private string mingxing

Member method: A star can have multiple brokers, a broker can serve multiple stars, do not correspond to stars, a broker can manipulate multiple star values, or it can be read-only.

Constructor: Default hidden, need to walk a method instantiation display, teacher t=new teacher

6.17 outline of object-oriented ideas and classes

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.