+ 1
Why include a header file for classname??
I have had c++ in my school... We learned simple way to only include header files like iostream, conio etc.. But here they say that WE NEED TO CREATE A SEPARATE CPP FILE FOR A CLASS AND DECLARE A HEADER FILE LIKE "IFNDEF" ETC... Help me out... Is it necessary or some other way of coding??
4 ответов
+ 5
The same class used by other classes of the same program.
+ 5
It's not necessary but if your classes are going to be used in multiple source code files it's standard practice to use a header with the declarations and include it where needed.
+ 1
Do u mean same class body in multiple programs??
+ 1
Header contains contracts, thus hides and abstracts implementation details (that is specified in the source - cpp - file). The relation between these two are include statements.