Hirdetés
Ú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
- Intel GAMER PC! Core i5 // 16GB DDR4 // GeForce GTX 1060 6GB // 128GB SSD + 1TB HDD
- LG OLED55B97LA
- Dell Latitude 7490 i5 8350U, 8-16GB RAM, fém fedlap, jó akku 27% ÁFÁS
- Eladó 2024 júliusában vásárolt új / iPad (10th gen) Blue 64Gb / Toll, Tok / GARANCIA
- T14s Gen2i 27% ÁFA 14" FHD IPS i7-1185G7 32GB 512GB NVMe ujjolv IR kam gar
Állásajánlatok
Cég: Ozeki Kft
Város: Debrecen
Cég: Ozeki Kft
Város: Debrecen