Hi all,
I am using a static method to instantiate a member of my class (the member happens to be a class too). When I assign to that member, nothing seems to be sticking and all properties inside my member are null. But if I directly create my member without using a static method to create it, I have no problems.. heres an example... [using php 4.4.4 by the way so there are no descriptor keyowrds *static*]
[php]
class DataColumn
{
var $_datastore;
function DataColumn()
{
// this does not work - this is the problem i am talking about
$this->_datastore =& DataStorage::Cr eateStorage($th is, $this->DataType);
// but, this will work
$this->_datastore =& new ObjectStorage() ;
}
}
[/php]
incase anyone is curious to what is happening in DataStorage::Cr eateStorage...
here it is.
[php]
class DataStorage
{
function CreateStorage($ container,$data Type)
{
switch($dataTyp e)
{
case "string":
return new StringStorage() ;
break;
case "int":
return new IntegerStorage( );
break;
case "real":
return new RealStorage();
break;
case "object":
return new ObjectStorage() ;
break;
........... etc...
}
}
}
}[/php]
Any thoughts on this would be greatly appriciated.
Please enclose any code within the appropriate code tags. See Posting Guidelines! - moderator
I am using a static method to instantiate a member of my class (the member happens to be a class too). When I assign to that member, nothing seems to be sticking and all properties inside my member are null. But if I directly create my member without using a static method to create it, I have no problems.. heres an example... [using php 4.4.4 by the way so there are no descriptor keyowrds *static*]
[php]
class DataColumn
{
var $_datastore;
function DataColumn()
{
// this does not work - this is the problem i am talking about
$this->_datastore =& DataStorage::Cr eateStorage($th is, $this->DataType);
// but, this will work
$this->_datastore =& new ObjectStorage() ;
}
}
[/php]
incase anyone is curious to what is happening in DataStorage::Cr eateStorage...
here it is.
[php]
class DataStorage
{
function CreateStorage($ container,$data Type)
{
switch($dataTyp e)
{
case "string":
return new StringStorage() ;
break;
case "int":
return new IntegerStorage( );
break;
case "real":
return new RealStorage();
break;
case "object":
return new ObjectStorage() ;
break;
........... etc...
}
}
}
}[/php]
Any thoughts on this would be greatly appriciated.
Please enclose any code within the appropriate code tags. See Posting Guidelines! - moderator
Comment