+ 2

[CLOSED] Are classes really used this much?

Lately I've been feeling like I have been using classes a lot (like for most of my projects). Is this how important classes are to C++ or am I just over-using them?

21st Aug 2019, 5:48 PM
UrBoyO
UrBoyO - avatar
4 Antworten
+ 4
Remember one of the magics of programming (solving problems) is the "divide and rule" principle. Methods could help you achieve this and above all, classes will do same. If you can make a million classes thus objects that achieve specific tasks, then you are good and going. The more specific tasks you have, the more classes you have, if you join them together and achieve your objectives, you are on a better track than making fewer dependent classes... Many classes are good, if they thrash specific issues, but avoid redundancy, creative classes with the same results! Use Inheritance, Polymorphism to make your programs elegant and void of redundancy
21st Aug 2019, 7:01 PM
Fogwe
Fogwe - avatar
+ 5
I guess the advantages of OOP are coming out more and more, the bigger a code becomes. When the program consists of many, many thousand lines, spreads across dozens or hundreds of files, and several people write parts for it, then it becomes more and more important that each unit 'protects its own status', so that things remain manageable. For codes of a few hundred lines as we beginners tend to write them, it can make things unnecessarily complicated to wrap it all into class packages.
21st Aug 2019, 6:14 PM
HonFu
HonFu - avatar
+ 3
HonFu [#GoGetThatBugChamp!] Ketan Lalcheta Fogwe Thank you! I thought about it a lot myself and with your help, I resolved my mental roadblock. Much appreciated! 😊
21st Aug 2019, 7:32 PM
UrBoyO
UrBoyO - avatar
+ 2
I don't feel it unnecessary... I uses nd can say that it helps... but in any matter, over usage is not useful... use it when necessary...
21st Aug 2019, 5:58 PM
Ketan Lalcheta
Ketan Lalcheta - avatar