3pcs Random Color Egg Separator

3pcs Random Color Egg Separator


Looking for an easy way to separate your egg yolks from your egg whites? Look no further than this 3pcs Random Color Egg Separator! Made of durable plastic, this egg separator is perfect for anyone who loves to cook or bake. Each color egg separator is different, you can make the perfect food for any occasion! A great gift for holidays, birthdays, graduation, weddings, or simply to share a simple tasty egg yolk recipe with your family and friends.

Specification:
Material: Plastic
Size: 24cm(l) x 6.4cm(w) x 9cm(h)
Color: Random
Package: 3pcs
Keywords: egg yolk,egg yolks,egg separatorQ:

How to access to a child class inside a function?

The question is how to access to a nested child class inside a function? For the following case I am aware to get all the attributes and methods of the parent class within the function. but I’m struggling to get what I need. Any clue?
//parent
class TestParent {
public $Name = ‘Parent Name’;
public function __construct() {

}
}

//Child
class TestChild extends TestParent {
public $Age = ‘Child Age’;

public function __construct() {
parent::__construct();
}
}

//Function
$temp = new TestChild();
//I need to access only the attributes that extends `TestParent` to $temp
function TestFunction($child) {
echo $child->getName(); //I get what I want.
}

A:

One way is to give it a special name:
function TestFunction($child) {
$temp = new TestChild();
$temp->_testParent($child);

echo $temp->Name;
}

Or, you can directly get back into the child class:
class TestParent {
public function __construct() {

}
}

class TestChild extends TestParent {
public $Age = ‘Child Age’;

public function __construct() {
parent::__construct();
}
}

function TestFunction($child) {
$temp = new TestChild();
//get into the child class and

Leave a Reply