Hey everyone (:
so, coming from java, i am a little confused how i properly use classes that i have written.
Here s the setup: i have written a class tokenizer in its own directory with a header, an internal header and several source files.
I have then written a class expression in a different folder. this class needs a tokenizer to function. do i use
#include <tokenizer.h>
to make everything i need available? research on the internet left me a bit confused as to when use "tokenizer.h" and <tokenizer.h>, and for the latter, I have to include a compiler flag, to tell g++ where to look for that header file? Is it even generally a thing to #include all classes that you are going to use? As i said, i come from java and as long as i have my different classes in the same package, i am free to use them. but as i understand it, the equivalent or the closest thing to a package is a namespace in c++, which we did not even cover yet.
So yea, a bit of confusion, and i cannot yet test everything as i am implementing a proper main function (in which i have to include both classes headers?!) and fighting with make.
Anything to help me out would be greatly appreciated, am having a little bit of a time struggle :D
regards,
jaqq
quick edit:
in a constructor, can i use :
1 2 3 4 5 6
|
Expression::Expression(Tokenizer tokenizer)
:
d_tokenizer(tokenizer)
{
}
|
as i would do with primitive datatypes? again, probably a question a compiler error may answer :<<