2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

C# 抽象とかインタフェスとか

Last updated at Posted at 2021-11-04

学習の足しになればいいような結論だけ

C# abstractinterfaceの違い。

問題の根源は、多重継承によるメモリの無駄である。
あ、これは今度のネタにしよう。

abstractは単一の継承のみ許可する。
 フィールドを持てる。

interfaceは無制限の継承を許する。
 フィールドを持てない。
 抽象メソッドとプロパティはOK。(実装を持たないプロパティ宣言ということ。)

詳細はこちら

こういう事を 教えるときに同時に教えた方がいい、教師役ってなんか頑張って欲しいわね。

間違ってたらごめんなさい。

困った事:
FindObjectOfType<>()メソッドにinterface型を指定して呼び出す事が出来ない。

ありがたい事にコメントを頂いてしまった。
一旦<Object>で取得してから、型チェックする流れで上手くいきました。

2
1
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?