M
michael.goossens
Hello everyone,
maybe some usefull information first: I'm a student, I can program and
most of my experience is in java but I always had the feeling java is
"the easy way out" so now I'm interested in some c++. I'm longing to
make a speedy raytracer and that is why I need c++ and need to learn
alot about how it works internally to see what choices are the best
way for an optimal speed result.
I have some troubles understanding the concepts of a header and all
around it. It seems that a header has the purpose to define classes
and functions. But its also possible to actually implement the classes
and functions in there. But why would someone do that? Is it better?
I see three options of implementation at the moment:
1) defining a header with the definitions and implement them in a .cpp
file
2) defining a header with the definitions and the implementations
3) using a cpp file and implement it all in there.
So what are the pro's and contras here? Currently I'm using using
option 1 since I learned it that way in a basic OO-language course.
Also, it is possible to define a range of multiple classes in the same
header file, why would I want that over the 1 header - 1 class
structure that I'm using now(probably a java influence here).
maybe some usefull information first: I'm a student, I can program and
most of my experience is in java but I always had the feeling java is
"the easy way out" so now I'm interested in some c++. I'm longing to
make a speedy raytracer and that is why I need c++ and need to learn
alot about how it works internally to see what choices are the best
way for an optimal speed result.
I have some troubles understanding the concepts of a header and all
around it. It seems that a header has the purpose to define classes
and functions. But its also possible to actually implement the classes
and functions in there. But why would someone do that? Is it better?
I see three options of implementation at the moment:
1) defining a header with the definitions and implement them in a .cpp
file
2) defining a header with the definitions and the implementations
3) using a cpp file and implement it all in there.
So what are the pro's and contras here? Currently I'm using using
option 1 since I learned it that way in a basic OO-language course.
Also, it is possible to define a range of multiple classes in the same
header file, why would I want that over the 1 header - 1 class
structure that I'm using now(probably a java influence here).