Why we need .h files because we have classes? 😅 | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Why we need .h files because we have classes? 😅

Class and header file are doing the same thing, right? So what is the difference between them 🤔

12th Aug 2021, 3:53 AM
K S Mirthun
K S Mirthun - avatar
4 ответов
+ 10
No, they don't have a similar purpose. Header files are used to store declarations in one location and then import them wherever we need them. Classes are used to create and manage new objects. it is the basic ingredient of OOP.
12th Aug 2021, 4:06 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Headers can contain classes, right?
12th Aug 2021, 5:57 AM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Martin Taylor Thanks a lot for the explanation.
12th Aug 2021, 11:39 AM
Calvin Thomas
Calvin Thomas - avatar
0
Ohh now I am clear bro.
12th Aug 2021, 4:19 AM
K S Mirthun
K S Mirthun - avatar