View Single Post
Join Date: Oct 2008
Posts: 29
Reputation: jbrock31 is an unknown quantity at this point 
Solved Threads: 1
jbrock31 jbrock31 is offline Offline
Light Poster

Re: Help with instance of one class in another

 
0
  #3
Nov 21st, 2008
Oops. I took all the calls to that when it would not work. Below is TimeOff.h where i am trying to use the maxSickDays instance and then its setHours member function. Thank you.

  1. #ifndef TIMEOFF
  2. #define TIMEOFF
  3. #include <iostream>
  4. #include "NumDays.h"
  5. #include <string>
  6. using namespace std;
  7.  
  8. class TimeOff
  9. {
  10. private:
  11. string name;
  12. int idNum;
  13. NumDays maxSickDays;
  14.  
  15. public:
  16. TimeOff();
  17.  
  18.  
  19. void setName ( string n )
  20. { name = n; }
  21. void setIdNum ( int id )
  22. { idNum = id; }
  23.  
  24. void setMaxSickDays( int h )
  25. { maxSickDays.setHours(h); } /// trying to access this instance of NumDays
  26.  
  27.  
  28. string getName()
  29. { return name; }
  30. int getIdNum()
  31. { return idNum; }
  32.  
  33.  
  34.  
  35. };
  36.  
  37. #endif
Reply With Quote