How to use a protected function from another class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: How to use a protected function from another class (/showthread.php?tid=77213) |
How to use a protected function from another class - JerryCode - 08-03-2020 Class A PHP Code: <?php Class B: PHP Code: <?php Error Call to protected method... How can I get the 'a' in Class B RE: How to use a protected function from another class - tgix - 08-03-2020 You don't get access to a() just because you extend from the same base class. You should probably look into using traits instead. RE: How to use a protected function from another class - InsiteFX - 08-03-2020 Read this: PHP.NET - Visibility RE: How to use a protected function from another class - JerryCode - 08-03-2020 (08-03-2020, 02:54 AM)tgix Wrote: You don't get access to a() just because you extend from the same base class. You should probably look into using traits instead. thanks |