6.19 Outline

Source: Internet
Author: User


With inheritance, there are many States;
Concept: Inheriting all subclasses of the same parent class, using different, they are a separate individual;

In the ordinary parent class, virtual methods can appear, and virtual methods can be overridden in subclasses;

Virtual method: Virtual
Override: Override

Parent class, base class
Subclass, derived class, Super class
------------------------------------------------------------------
Abstract class: Abstraction
is used to be inherited, cannot instantiate an object, because there is no constructor function;
Abstract methods, can not have the main body of methods, can only define the structure of the method;

Abstract methods or abstract attributes can only exist in abstract classes;
Abstract methods and abstract attributes are not necessarily the only abstractions in the class.


-----------------------------------------------------------------
Interface:
In team development, a class that requires multiple modules to be combined is the complete class;
Multi-personal development of different modules, and finally to put them together, relying on the interface;

A class that needs to inherit multiple classes is complete, but the program stipulates that a class can inherit only one parent class;
In order to solve this problem, there is an interface, a class can inherit countless interfaces;

People in this category, need to eat, skills, sports, is a complete person;
Eating this function is a separate development, as the most basic parent class, using the abstract class;
Skill and movement, which are developed by B and C, require people to inherit this class, but already have the parent class;
Then B and C on the interface used to let people this class can inherit their written two function modules;

The method inside the interface is much like an abstract method;

Interface is also a function of norms and constraints;


IS and as operators:
is to determine if it is a type that returns TRUE or False
o as Ren; if the conversion succeeds, no problem;
If the conversion is not successful, the error is not reported, but a null value is returned

6.19 Outline

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.