13-Application of inheritance

Source: Internet
Author: User
/*1. The use of inheritance 1> when two classes have the same properties and methods, you can extract the same things into a parent class 2> when Class A fully owns some of the properties and methods in class B, consider having class B inherit a Class A {    int _age;    int _no; }  b:a {    int _weight;}  Inheritance: xx is xxx//combination: XXX has xxx  2. Combination A {     int _age;     int _no; }  B {     A *_a;     int _weight; }*/@interface score:nsobject{    int _cscore;    int _ocscore;} @end @implementation score@end@interface student:nsobject{    //Combo/************* Format * * * * * Uppercase class name *_ lowercase class name; ************* /    score *_score;//    int _cscore;//    int _ocscore;    int _age;} @end @implementation Student@end

  

13-Application of inheritance

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.