1. 函数的复写(override)2. 使用super调用父类的成员函数1. 函数的复写
修改父类中成员函数, 就叫复写2. 使用super调用父类的成员函数 this()就可调用本类的构造函数, this.函数名 即可调用本类的成员函数
super()可调用父类的构造函数, super.函数名 ...
分类:
其他好文 时间:
2014-05-27 01:14:31
阅读次数:
289
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PRO...
分类:
其他好文 时间:
2014-05-24 00:02:33
阅读次数:
227
内存管理重写dealloc方法@implementation Dog#pragma mark
当一个对象从内存中移除的时候,就会被调用- (void) dealloc{ NSLog(@"----Dog被销毁了------");
//一定要调用super的方法,写在该方法的最后 [sup...
分类:
移动开发 时间:
2014-05-23 12:03:27
阅读次数:
347
-(void)viewDidload{[super viewDidLoad]; scrollView
= [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
scrollView.backgroundColor = [.....
分类:
其他好文 时间:
2014-05-19 20:21:40
阅读次数:
284
域和静态方法不具有多态性:public class Test3 { public static
void main(String[] args) { Super sup = new Sub(); System.out.println(sup.field);
System.out.println...
分类:
其他好文 时间:
2014-05-19 14:28:59
阅读次数:
314
程序代码:
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize visibleSize = CCDirector::s...
分类:
其他好文 时间:
2014-05-18 10:10:11
阅读次数:
299
super.onDestroy();
的问题。注意:没有显式地在自己的方法中调用父类Activity的onDestroy是会报错的。我的问题很简单,在我覆盖的onDestroy(),方法中需要调用父类的onDestroy。我就是不懂调用的时机,就像下面两种。protectedvoidonDestro...
分类:
移动开发 时间:
2014-05-17 19:13:46
阅读次数:
767
Problem Description
XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提...
分类:
其他好文 时间:
2014-05-16 01:43:49
阅读次数:
270
核心点:
super关键字,表示调用的是父类对象。
this关键字,表示调用的是当前运行类对象。
那么如果在父类中,使用了关键字,this,此时的this指的是什么呢?
看下面的例子,再加深理解核心店的第二句话就ok了。
parent类:
package com.ghsy.thissuper;
public class Parent {
public void init(){
...
分类:
其他好文 时间:
2014-05-14 20:04:29
阅读次数:
217
iOS 设置UILabel 的内边距-
(void)drawTextInRect:(CGRect)rect { UIEdgeInsets insets = {0, 5, 0, 5}; [super
drawTextInRect:UIEdgeInsetsInsetRect(rect, in...
分类:
移动开发 时间:
2014-05-14 10:12:21
阅读次数:
4319