0

So we need to create both Myclass.h & myclass.cpp files on all programs?

23rd Jul 2017, 4:19 AM
Rahul Viswam
Rahul Viswam - avatar
5 ответов
+ 11
No. Your class definition can exist within your class header (or simple within your main.cpp).
23rd Jul 2017, 5:12 AM
Hatsy Rei
Hatsy Rei - avatar
0
thanks:)
23rd Jul 2017, 8:13 AM
Rahul Viswam
Rahul Viswam - avatar
0
If you want you can put everything in the same file. It is just not good for maintenance.
23rd Jul 2017, 10:19 AM
Denis Felipe
Denis Felipe - avatar
0
I'd prefer putting everything in same file..cuz making two files is umm complicated
25th Jul 2017, 7:58 AM
Rahul Viswam
Rahul Viswam - avatar
0
Hatsy, sometimes you don't want your client to have access to your compiled code, but you want them to knoe the interface to use your code. That is one reason to separate in header and implementation.
26th Jul 2017, 7:36 AM
Denis Felipe
Denis Felipe - avatar