note 129195 added to language.types.object
| From: | engstar.mail.ru via php-notes | Date: | Thu, 25 Jan 2024 11:39:06 +0000 |
| Subject: | note 129195 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221149@lists.php.net to get a copy of this message | ||
my solution when $clone = (MyClass) $class; don't work
<?php
interface MyInterface
{
public function returnObject();
}
abstract class MyAbstractClass implements MyInterface
{
public function returnObject()
{
return $this;
}
}
class MyClass extends MyAbstractClass
{
public function info()
{
echo 'hello';
}
}
function hi(MyInterface $test)
{
$cl = $test->returnObject();
$cl->info();
}
hi(new MyClass);
--------------------------------------------
output: hello
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 176.193.0.72)
----
Manual Page -- https://php.net/manual/en/language.types.object.php
Edit -- https://main.php.net/note/edit/129195
Del: integrated -- https://main.php.net/note/delete/129195/integrated
Del: useless -- https://main.php.net/note/delete/129195/useless
Del: bad code -- https://main.php.net/note/delete/129195/bad+code
Del: spam -- https://main.php.net/note/delete/129195/spam
Del: non-english -- https://main.php.net/note/delete/129195/non-english
Del: in docs -- https://main.php.net/note/delete/129195/in+docs
Del: other reasons-- https://main.php.net/note/delete/129195
Reject -- https://main.php.net/note/reject/129195
Search -- https://main.php.net/manage/user-notes.php