FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Calling child class from parent class
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Calling child class from parent class [message #181092] Thu, 11 April 2013 19:48 Go to previous message
daveh is currently offline  daveh
Messages: 18
Registered: March 2013
Karma:
Junior Member
Is this possible?

class GNP_DIRECTORY
{
public $m_rules;
public $m_names; //array of GTCM_GNP object names
public $m_cnt;

public function __construct()
{
$this->m_rules = array();
$this->m_names = array();
$this->m_cnt = 0;
}
public function register($name, $rule, $dat_file, $server, $port)
{
if(in_array($name, $this->m_names))
{
$this->m_rules[$name][] = $rule;
return $this->m_names[$name];
}
$$name = new GTCM_GNP($this);
if(!$$name)
{
return FALSE;
}
$this->m_cnt++;
$this->m_names[] = $name;
$this->m_rules[$name] = array($rule);
return $$name;
}
}
class GTCM_GNP extends GNP_DIRECTORY
{
private $m_server;
private $m_port;
private $m_dat_file;
private $m_socket;
private $m_buffer;
private $m_proc_num;
private $m_open_region;
private $m_cur_region_no;

public function __construct($name = null, $rule = null, $dat_file, $server,
$port)
{
(initialization code)
}

public function do_something
{
return $this->variable;
}
}
Basically I need to do: GNP_DIRECTORY[$$names]->do_something();

or I want to do some method in GTCM_GNP by referring to a specific
GNP_DIRECTORY

Will this (pseudo)code work or is there a better approach.

Thanks
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Calling a php file from another on apache server
Next Topic: Re: eine PHP mit video faehigkeit
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 16:54:16 GMT 2024

Total time taken to generate the page: 0.05139 seconds