When defining a class.h?hpp? Which one?

Asked 2 years ago, Updated 2 years ago, 32 views

When I was defining the class, I did it at .h In boost libaray, everyone defined a class in .hpp, right?

Maybe it's because I've never used it like that, but it looked weird Is there any advantage of using .hpp?

c++

2022-09-22 22:32

1 Answers

The header file of C can be .h and the header file of C++ can be .hpp.

C and C++ header names are written differently for the following reasons:

C and C++ are different languages, and it is not recommended because it is dangerous to share both. Therefore, it distinguishes which language is spoken by naming the file differently.


2022-09-22 22:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.