Welcome Guest, Not a member yet? Register   Sign In
[Solved]public,private,protected function
#1

[eluser]MWebber[/eluser]
Hi,
How can i make private or protected function in model(which updates table for example) and call it with public controller?

It gives me error:
Code:
Call to private method ...

Is there some "work-around" to have private function and access it from the controller(i've seen such in cms's made in CI,but it doesnt work for me)?

Thanks
#2

[eluser]WanWizard[/eluser]
eh, private != public.

If you want to make the method publicly accessable, why declare it as private?
#3

[eluser]MWebber[/eluser]
Then how to call private model functions in controller?
#4

[eluser]WanWizard[/eluser]
You don't.

That's the definition of the word 'private'. They are only accessable from within the class itself.
#5

[eluser]MWebber[/eluser]
Then same for protected(exept the inheritance)?

Thank you very much!
#6

[eluser]OliverHR[/eluser]
Simple OO Smile




Theme © iAndrew 2016 - Forum software by © MyBB