RE: [PHP] How to access any function of a any class?
| From: | Kim Madsen | Date: | Thu, 17 Mar 2005 08:02:10 +0000 |
| Subject: | RE: [PHP] How to access any function of a any class? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210943@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: pf@sistemasdinamicos.com.ar [mailto:pf@sistemasdinamicos.com.ar]
Sent: Wednesday, March 16, 2005 2:27 PM
To: php-general@lists.php.net
Subject: [PHP] How to access any function of a any class?
Hello.
Please consider this:
class A {
[snip]
class B {
[snip]
class Container{
function Container(){
[snip]
$MyOBJ=new Container();
> The problem is that "sometimes" member functions and variables can be
> reached this way, but sometimes not (mainly variables or file pointers)
> depending WHEN you create the object and when (for example) you create a
> file pointer inside some class.
> What I want to do is to be able to use any function of any class from any
> function of any class.
That´s not possible if You wanna do _entirely_ OOPD programming. You can let B inherits from A and
let Container inherits from B then an instance of Container will contain all functions, but a
instance from A cannot call the function Container. Read more here: http://dk2.php.net/manual/en/keyword.extends.php
You could just drop the idea of several classes or the OOP programming (I removed the D on purpose
due to the bad design ;-)
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper
Naverland 31
DK-2600 Glostrup
www.comx.dk
Telefon: +45 70 25 74 74
Telefax: +45 70 25 73 74
E-mail: km@comx.dk