I have following php class
class User implements IUser
{
public function __construct($i_objParent = NULL)
{
}
}
When I login successfully I create object of User class.
There is another class named Student class as follows which extends User Class
class Student extends User
{
public function __construct($i_objParent = NULL)
{
parent::construct($i_objParent);
}
}
Now as I said eariler I already have object of User class how can I construct Student object from existing User Class.
I think it may be possible by passing existing User class object to constructor of child class here Student class object?
Also, Is above approach OK?