classes and methods
Posted: Thu Aug 24, 2006 9:28 am
Hi.
Let's say i have two classes, a and b. I would like to use a's methods AND variables inside b's functions. How do i do that?
1.Do i instantiate a inside of b::__construct?
2.Do i use a::function()? - i don't think a::variable would work though
3.Other ideas?
I've read articles about the observer pattern. I don't think i understood much, but i don't think i can use it here, right?
I would like to have a MVC foundation classes-style approach. I want the Model class's methods and variables to be accesible from the Controller, and Controller's methods and variables to be accesible from within the templates of the View.
What would be easier and most straightforward?
Thank you.
Let's say i have two classes, a and b. I would like to use a's methods AND variables inside b's functions. How do i do that?
1.Do i instantiate a inside of b::__construct?
2.Do i use a::function()? - i don't think a::variable would work though
3.Other ideas?
I've read articles about the observer pattern. I don't think i understood much, but i don't think i can use it here, right?
I would like to have a MVC foundation classes-style approach. I want the Model class's methods and variables to be accesible from the Controller, and Controller's methods and variables to be accesible from within the templates of the View.
What would be easier and most straightforward?
Thank you.