<?php
//5.2.6
class Sample {
private function PrivateBar() {
echo 'private called<br />';
}
public static function StaticFoo() {
echo 'static called<br />';
$y = new Sample();
$y->PrivateBar();
}
}
Sample::StaticFoo();
?>
Yukarıdaki kod çıktısı:
"static called
private called"
Neden $ y> PrivateBar (); Bir hata atmak değil? Bu sonuçta özel bir fonksiyondur.
Bunun arkasındaki nesne yönelimli tasarım mantığı nedir? Bu PHP özgü, yoksa bu standart OOP nedir?