why separate class file is created in c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

why separate class file is created in c++ ?

1st Aug 2016, 6:29 AM
Simant |Kingpin|
Simant |Kingpin| - avatar
3 Answers
+ 2
It's not necessary to create a separate files. Files are separated for better readability. For eg. You just want to know WHAT a particular class can do. You are not interested to see HOW it does. In that case, all you need to see is the structure of the class. You can write unlimited code in single file but when the original coder is gone or when you need to change or debug, it'll be a nightmare to search amongst millions of line of code. Rather, separate files give you a modular structure. Not only it promotes reuse but also makes the design manageable to understand and debug.
1st Aug 2016, 4:23 PM
Nick D.
Nick D. - avatar
0
Well explained, thanks.
1st Aug 2016, 4:40 PM
Simant |Kingpin|
Simant |Kingpin| - avatar
0
For time pass
1st Aug 2016, 5:44 PM
Shubham Gupta
Shubham Gupta - avatar