adambard / adambard/learnxinyminutes-docs

Objective-C: Object declarations

オープン
#691 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Markdown
スター
12.3k
フォーク
3.7k
平均マージ
13時間 10分
マージ済み PR(30日)
6

説明

[The page](http://learnxinyminutes.com/docs/objective-c/) states the following:

```
// Object declarations
// Put the * in front of the variable names for strongly-typed object declarations
MyClass *myObject1 = nil; // Strong typing
id myObject2 = nil; // Weak typing
```

However, this is misleading if not completely incorrect.
The `*` is the same as it is in C, it means it's the variable is a pointer. It's not clear what is meant by 'strong' or 'weak' typing here, but it's my understanding that, like C, Objective-C is a weakly-typed language (though statically enforced at compile-time).

Rather, I think what is being said here is that `myObject` is referencing an explicit (statically-checked) object of type `MyClass` while `myObject2` is referencing any Objective-C object.

I would fix this myself, but I'm just learning the language and would prefer to defer to someone with more expertise.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。