首页 > 其他 > 详细

14:super关键字

时间:2016-02-21 18:33:39      阅读:174      评论:0      收藏:0      [点我收藏+]

本小节知识点:

1.super基本概念 2.super的作用


1.super基本概念

  • super是个编译器的指令符号,只是告诉编译器在执行的时候,去调谁的方法.
    • self是一个隐私参数;
      self refers to the object receiving a message in objective-C programming.
      
    • super 并不是隐藏的参数,它只是一个“编译器指示符”,它和 self 指向的是相同的消息接收者
super is a flag that tells the compiler to search for the method implementation in a very different place. It begins in the superclass of the class that defines the method where super appears.

2.super的作用

+ 1.直接调用父类中的某个方法
+ 2.super在对象方法中,那么就会调用父类的对象方法
 super在类方法中,那么就会调用父类的类方法
  • 使用场合:
    • 子类重写父类的方法时想保留父类的一些行为

14:super关键字

原文:http://www.cnblogs.com/iOSxgj/p/5205269.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!