vic vance Posted October 25, 2011 Share Posted October 25, 2011 I have been away from PHP for a long time and I was looking over my old scripts. I did PHP OOP at one time and I used a paticular method to connect all my methods up and load them. I have been looking at other peoples code and when I look at my code it does not even feel like OOP, I want to know how to you link all the methods (or is it called functions?) in a class up and return them? I use to do this: <?php class quickFUNC { function note_pad() { // code for notepad } function quickAdminFunc() { // code for admin func $this->note_pad(); } } $quickFUNC = new quickFUNC; if(isset($_GET['id'])) { $act = $_GET['id']; } else { $act = NULL; } switch ($act) { case 1: //some random code to launch case 1 break; default: $quickFUNC ->quickAdminFunc(); ?> This was my code back in the days, as you can see the notepad was called in the admin function then made the admin function default in the case switch. I looked at all my script and the all are layed out like this :S.. Can I get some help please, thank you. Quote Link to comment Share on other sites More sharing options...
shlumph Posted October 25, 2011 Share Posted October 25, 2011 I'm not really sure what you're asking. To start, think of classes as nouns. And functions are behaviors for that noun. I'd recommend reading this: http://www.phpfreaks.com/tutorial/oo-php-part-1-oop-in-full-effect Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted October 26, 2011 Share Posted October 26, 2011 Make sure you understand the five basic concepts first: ICAPE - Inheritance - Classification - Abstraction - Polymorphism - Encapsulation Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.