Welcome Guest, Not a member yet? Register   Sign In
Parent class to call children method
#1

[eluser]Unknown[/eluser]
Is it possible to call child class method from parent class method, normally in OOPS concept we declare the parent class as virtual and I think this provides the method to call child class method from parent class. Please help me out to accomplish this in codeignitor.
Actually My intension is to have a common function dealing with the insertion of the form.
I have a master controller where take a function and the arguments to this function is the controller name,so i need to route to call other controller from my master controller.
#2

[eluser]WanWizard[/eluser]
If you have this situation, there's a flaw in your class design.

If you want this, define the parent class as abstract, and the method as abstract in the parent class, to force it to be available in the child, and to force a child to be present.
When you do this, you can just use $this->method() in any parent method, which will call the method defined in the child.

In the CI architecture, if you have a common method, you should store this in a library. Also, CI by default does not support controllers calling controllers...




Theme © iAndrew 2016 - Forum software by © MyBB