I'm trying to move into OOP development and am turning to here as I'm sick of searching the web and finding only the very basic information about what classes are and how they can inherit from each other - that I understand.
What I don't understand as yet is how all these classes can be stored in different files, doted around a folder structure, and yet all you need to do to use the class is just mention its name in your code. How does this work exactly?
And on a related note, if anyone can recommend a good book or online tutorial which will provide a good foundation in OOP (preferably php based) I'd be very grateful.
I've found it extremely helpful to look at existing code when my research efforts hit a wall. There are plenty of scripts, packages, frameworks, and applications that follow excellent PHP coding practices that can be studied and learned from. There have been several questions on SO that point out a couple good ones.
My favorite so far have been the Zend Framework.
What you're describing has nothing to do with object-oriented programming per se. It's just a feature of certain specific languages. Those languages do it by enforcing some sort of convention for how files are stored (for example, the class
foo.bar.quux
might have to be in some standard location at foo/bar/quux.py).I have one remark, although I am huge (understatement) fan of PHP (down vote me all you want, I don't care! one day we will be accepted ;-), PHP is not really the path you want to walk down when learning OOP.
PHP does things, well, different. Different is good, don't get me wrong, I love different, but it is also unconventional. Unconventional, also good, almost a synonym for Google, if you ask me, but we do not live in an unconventional world! You can not just walk up to somebody and say; "Hey, I know OOP, I learned it in PHP". It may rhyme, but people just won't take you seriously afterwards. Don't ask me why, but it is as true as yellow bananas. I've been there.
so if you want to learn conventional OOP, try Java. it's as conventional as they come (which is neither bad nor good).
I have honestly never backed myself up so many times in a 20-sentence post. Gotta watch ma' rep though. :-D