Interview question: there are several ways in which a method under the constructor (non-static method) does not want to perform the construction?

topic description

A method under the constructor (non-static method) does not want to execute the constructed method

related codes

/ / Please paste the code text below (do not replace the code with pictures)

 class website extend site
 {
        public function __construct()
        {
                echo "site";
        
        }
        public function distgoods()
        {
        
        echo "123";
        
        }
 
 
 }

what does the distgoods () method do without it to execute the constructor

Apr.07,2021

inherit another one and write an empty constructor


 class website1 extends website
 {
    //
    public function __construct()
    {
    }
 }
(new website1)->distgoods();

tell you another cool techs:
directly website::distgoods (); this is also possible

  • Constructor problem

    I have a base class, Base.php, that initializes the constructor. public function __construct() { parent::__construct(); $this->authWen(); } The constructor calls a permission verification method. However, in addition to true...

    Mar.14,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9f1ab-1a2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9f1ab-1a2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?