+ 1

When you add the header file so you can use its objects, is that a form of inheritance?

28th Jul 2016, 11:39 AM
Goitse
2 Respuestas
0
its called importing if u import iostream header u have access to all those features tht iostream included
28th Jul 2016, 1:27 PM
Suhail Pappu
Suhail Pappu - avatar
0
It's not inheritance. To #include a file, just means for that the compiler reads the file. You could imagine that beginning from the cpp file in the compiler call all includes are added to one big file with the cpp (some tools actually do this to shorten compile time). It's nothing more and nothing less. Headers are used to declare elements you want to use in your cpp. Inheritance defines a relation between classes. No headers needed. Still classes are put into different files (headers, implementation files) to separate the declarations and definitions of one thing from the other (fosters reuse).
28th Jul 2016, 11:28 PM
Stefan
Stefan - avatar