掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
C++のインスタンスメンバの関数ポインタ (ID:69296)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
struct person { static int howmany_persons; date birthday; string firstname; string lastname; person(const date& bd, const string& fn, const string& ln) : birthday(bd), firstname(fn), lastname(ln) { ++howmany_persons; } ~person() { --howmany_persons; } static int get_howmany_persons() { return howmany_persons; } int get_age(date d=get_todays_date()); }; とか書いたら static と non-static の違いがわかるかしら? non-static は「ブツ(この場合人)を特定しないと原理的に意味の無いデータや処理」 static は「ブツ(この場合人)によらないデータや処理」 ブツを特定する = インスタンスを特定する = this を指定する よってこの両者が互換になることは基礎設計レベルでありえない。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.