PHP インター・フェイスッ!
PHPでジョジョを書こうかなというカテゴリーです。
少しアレンジを加えただけで、タイトルがもうジョジョ風です。ベネです。
いいですね。今後もベイビー・フェイス!みたいなノリで書こうと思います。
☆スタンド・インターフェイス
interface stand {
const TYPE="stand";
public function skill();
}
☆スタンド・抽象クラス
abstract stand_abst implements stand {
protected $name = null;
protected $growth = null; //成長性
protected $offensive = null; //攻撃力
protected $quickness = null; //機密動作性・・・などなど
public function skill() {
echo $this->speech();
}
}
☆クラス・スタープラチナ
class starPlatinum extends stand_abst{
protected $name = "スタープラチナ(星の白金)";
protected $growth = "A";
protected $offensive = "A";
protected $quickness = "A";
public function speech() {
return "オラオラオラオラ";
}
}
☆クラス・ザ・ワールド
class theWorld extends stand_abst{
protected $name = "ザ・ワールド(世界)";
protected $growth = "A";
protected $offensive = "A";
protected $quickness = "B";
public function speech() {
return "無駄無駄無駄無駄ァーッ!";
}
}
$stPl = new starPlatinum;
$stPl->skill();
これでオラオラされる。
$theW = new theWorld;
$theW->skill();
これで無駄無駄される。
成長性等は、人に本を貸しているので確認できず、曖昧です。
でも、おおむねこんな感じでしょうか。
インターフェイスやら、継承・実装・final・abstract等の
PHP5の概念がわからない時に、メモにとってあった内容を書き起こしてみました。
果たしてこういう理解でいいのでしょうか。
PHPでジョジョを書こうかなというカテゴリーです。
少しアレンジを加えただけで、タイトルがもうジョジョ風です。ベネです。
いいですね。今後もベイビー・フェイス!みたいなノリで書こうと思います。
☆スタンド・インターフェイス
interface stand {
const TYPE="stand";
public function skill();
}
☆スタンド・抽象クラス
abstract stand_abst implements stand {
protected $name = null;
protected $growth = null; //成長性
protected $offensive = null; //攻撃力
protected $quickness = null; //機密動作性・・・などなど
public function skill() {
echo $this->speech();
}
}
☆クラス・スタープラチナ
class starPlatinum extends stand_abst{
protected $name = "スタープラチナ(星の白金)";
protected $growth = "A";
protected $offensive = "A";
protected $quickness = "A";
public function speech() {
return "オラオラオラオラ";
}
}
☆クラス・ザ・ワールド
class theWorld extends stand_abst{
protected $name = "ザ・ワールド(世界)";
protected $growth = "A";
protected $offensive = "A";
protected $quickness = "B";
public function speech() {
return "無駄無駄無駄無駄ァーッ!";
}
}
$stPl = new starPlatinum;
$stPl->skill();
これでオラオラされる。
$theW = new theWorld;
$theW->skill();
これで無駄無駄される。
成長性等は、人に本を貸しているので確認できず、曖昧です。
でも、おおむねこんな感じでしょうか。
インターフェイスやら、継承・実装・final・abstract等の
PHP5の概念がわからない時に、メモにとってあった内容を書き起こしてみました。
果たしてこういう理解でいいのでしょうか。