Hello!
I've never used OOP beforse, so I can't understad how to design an object's class. Most tutorials are only explaining OOP syntax, but they don't explain deeper principles how to use OOP.
For example, if I want to make a class which would list all files in some directory, should I make that class so that EVERY listed file is an instance of that class with it's own properties and methods, or should I make only one instance of that class with a constructor method, that calls listFiles method, sets curret directory propertie, etc... ?
Hope you can share some links or book names where OOP would be explained deeper.
Thanks.
Unfortunately, explaining OOP is a little like explaining how to use an if statement correctly. You kind of play with examples of OOP programs for a while, and you look at other designs, or you might pick up a book of about 250 pages that will go way in depth, and one day you start getting those AHA moments.
Looking at your example, for instance, it depends ENTIRELY on what you want done. You may have several objects, or just one that contains a list of strings, or...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks