2011-01-31 15 views
1

クラスを作成し、すべての変数を初期化するメソッドを作成しました。エラー:互換性のない型の代入

の.h

-(void) initWithX:(float *)x_ andY:(float *)y_ andWidth:(float *)width_; 

上との.m上*

-(void) initWithX:(float *)x_ andY:(float *)y_ andWidth:(float *)width_{ 
    [super init]; 
    x = x_; *** 
    y = y_; *** 
    width = width_; *** 
} 

行は私にエラー "の割り当てで互換性のないタイプ" を与えるが、私は理解していない:私は与えています.hで言われているように3つの浮動小数点!

を使用すると、フロートポインタを求め、おそらく変数をフロートするためにそれらを割り当てているすべての

答えて

5

*を除去することにより、値によって、あなたの山車を渡します

- (void)initWithX:(float)x_ andY:(float)y_ andWidth:(float)width_; 

- (void)initWithX:(float)x_ andY:(float)y_ andWidth:(float)width_ { 
    [super init]; 
    x = x_; 
    y = y_; 
    width = width_; 
} 

をそれ以外の方法は、彼らの実際のプリミティブを(float *)フロートへポインタを求め、およびされていません。

1

ありがとうございます。メソッドの宣言でアスタリスクを取り出します。

関連する問題