Új hozzászólás Aktív témák
-
Sk8erPeter
nagyúr
válasz Lacces #10518 üzenetére
Ja, de most végül is mi a kérdés?
Pont meg volt nyitva a NetBeans, úgyhogy bepötyögtem neked egy rövid példát a kódjaid alapján, abból hátha megérted, próbáld ki, kiírat minden szirszart:
<?php
class Admin {
public $valami = 0;
public function ez() {
return __METHOD__;
}
}
class Child extends Admin {
public function __construct() {
$this->valami = 1;
}
public function ez() {
return __METHOD__;
}
public function az() {
$parentMethodReturnValue = parent::ez();
return 'child: "'. __METHOD__.'", parent: "'.$parentMethodReturnValue.'"';
}
}
function my_var_export($var, $text = '...', $output_type = TRUE) {
if (gettype($var) === 'string') {
$var = htmlentities($var);
}
return '<p>' . $text . ($output_type ? ' (' . gettype($var) . ')' : '') . ':</p><pre>' . var_export($var, TRUE) . '</pre>';
}
$admin = new Admin();
$child = new Child();
echo my_var_export($admin, '$child');
echo my_var_export($admin->valami, '$child->valami');
echo my_var_export($child, '$child');
echo my_var_export($child->valami, '$child->valami');
echo my_var_export($child->ez(), '$child->ez()');
echo my_var_export($child->az(), '$child->az()');=================
KIMENET:
$child (object):
Admin::__set_state(array(
'valami' => 0,
))
$child->valami (integer):
0
$child (object):
Child::__set_state(array(
'valami' => 1,
))
$child->valami (integer):
1
$child->ez() (string):
'Child::ez'
$child->az() (string):
'child: "Child::az", parent: "Admin::ez"'[ Szerkesztve ]
Sk8erPeter
Új hozzászólás Aktív témák
- Eladatnák az Ubisoftot
- "A homoszexualitás természetellenes" 😠
- Építő/felújító topik
- Nvidia GPU-k jövője - amit tudni vélünk
- PlayStation 5
- Raspberry Pi
- Billentyűzettel autóznék újra, van még ilyen gém?
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- CMF Phone 1 - egy jó telefon
- VR topik (Oculus Rift, stb.)
- További aktív témák...
- Gigabyte Ryzen Gaming PC: RTX 2060 Super 8Gb / 16Gb Ram / 512Gb SSD
- LENOVO LEGION GO 83E10032HV + INGYEN futár
- HP Pavilion x360 14-dy Érintős hajtogatós Laptop Tab 14" -35% i5-1135G7 16/512 FHD IPS
- Bomba ár! Dell Latitude 5501 - i7-9850H I 32GB I 512SSD I Nvidia I 15,6" FHD Touch I Cam I W11 I Gar
- Bomba ár! Lenovo ThinkPad Yoga 370 - i5-G7 I 8GB I 256SSD I 13,3" FHD Touch I W10 I Cam I Gari!
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Ozeki Kft
Város: Debrecen