including files

B

Blair Fonville

Hi,

I have a basic c++ question to which I can't find an answer in my books.
Suppose I have a pair of files date.h/date.cpp which creates a class
"date". I then have a pair of files calculator.h/calculator.cpp which
creates a class "calculator". The calculator uses the date class (so I
have an #include "date.h" in my calculator.h file). From now on, in any
new programs which I may write, I would like to be able to use my
calculator class and have the date class be completely transparent. So
in my new program, I'll #include "calculator.h" and instantiate
calculator, but have no knowledge of the existance of date. How can I do
this? I always get compile errors (or are they link errors? I don't
recall) unless I add the date.h/date.cpp files to my project. I don't
want to have to add these files to my project each time, when I don't
need them - calculator does, but my program only needs them implicitly.

Thanks,
Blair
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top