Defining, Implementing, and testing a class?

Hi,
I've been working on this for over a week and I still can't get it right. I'm supposed to define a class to represent a date with 3 data members (month, day, and year),and include a complete set of accessors, mutators, and constructors, etc. to print a date as both: month/day/year, and month day, year (like January, 12, 2012). Any advice would be much appreciated. Thanks! Here's what I have (all three programs).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Date

{
        private:

          int day;  // Day for the Date class
          int month;  // Month for the Date class
          int year;  // Year for the Date class

        public:

          Date();

          int GetDay();
          int GetMonth();
          int GetYear();
          int GetDate();
          int ShowWithName();

          void SetDay(int d);
          void SetMonth(int m);
          void SetYear(int y);
          void SetDate(int m, int d, int y);
          void ShowWithName();
};

AND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "date.h"

        Date::Date() {

         int m
         int d
         int y
          }

        int Date::month {

          int m
          return m;

          }

        int Date::day {

          int d
          return d;

          }

         int Date::year {

          int y
          return y;

          }

        int GetDate::() {

          return Date;

          }

        void Date::SetMonth(int m) {

          month = m

          }

        void Date::SetDay(int d) {

          day = d
          }

        void Date::SetYear(int y) {

          year = y

          }

        void SetDate::() {

          << cout << m << "/" << d << "/" << y;

          }


          switch (m)

          {

          case 1 : cout << "January ";
            break;
          case 2 : cout << "February ";
            break;
          case 3 : cout << "March ";
            break;
          case 4 : cout << "April ";
            break;
          case 5 : cout << "May ";
            break;
          case 6 : cout << "June ";
            break;
          case 7 : cout << "July ";
            break;
          case 8 : cout << "August ";
            break;
          case 9 : cout << "September ";
            break;
          case 10 : cout << "October ";
            break;
          case 11 : cout << "November ";
            break;
          case 12 : cout << "December ";
            break;
          }
          cout << d << ", " << y;

          }
}

AND to test the class:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "date.h"
#include <iostream> //required for cout

using namespace std;

int main()

        Date dt;

          cout << dt.GetMonth() << "is the month after the constructor/n";

          dt.SetMonth(12);

          cout << dt.GetMonth() << "is the month after mutator/n";

          cout << dt.GetDay() << "is the day after the constructor/n";

          dt.SetDay(25);

          cout << dt.GetDay() << "is the day after mutator/n";

          cout << dt.GetYear() << "is the year after the constructor/n";

          dt.SetYear(2011);

          cout << dt.GetYear() << "is the year after the mutator/n";

          cout << dt.GetDate() << "is the date after the constructor/n";

          dt.GetDate(12/25/2011);

          cout << dt.GetDate() << "is the date after the mutator/n";

          cout << dt.ShowWithName() << "is the date shown with month name after the constructor/n";

          dt.ShowWithName(December 25, 2011);

          dt.ShowWithName() << "is the date shown with month name after the    mutator/n";

return 0;

}

I get an overwhelming number of errors, so I didn't list them. I hope that's okay.
You have two functions named ShowWithName() but no definition. Remove one of them and define it.

Why all the variable declarations without semicolon? Get rid of them.

What is this?
1
2
3
4
 int Date::day {
          int d
          return d;
}

day is a member variable. I don't know what you trying to do so get rid of it. same with month and year.

void SetDate::() should be void Date::SetDate()

And then you have a switch statement outside a function. I guess that should be inside ShowWithName?

That is some of the problems. I hope you can fix the rest by yourself. Next time try to write the code in small steps. If you have function that doesn't compile, make sure it compiles before writing the next function. When you get a bunch of errors like this you always fix the first error first because errors further down could be caused by earlier errors.

Thanks! But I'm still not understanding. I tried to make your suggested changes. Here it is now:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Date

{
        private:

          int day;  // Day for the Date class
          int month;  // Month for the Date class
          int year;  // Year for the Date class

        public:

          Date();

          int GetDay();
          int GetMonth();
          int GetYear();
          int GetDate();

          void SetDay(int d);
          void SetMonth(int m);
          void SetYear(int y);
          void SetDate(int m, int d, int y);
          void ShowWithName(int m, int d, int y);
};

AND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "date.h"

        Date::Date() {

         int m
         int d
         int y
          }

        int GetDate::() {

          return Date;

          }

        void Date::SetMonth(int m) {

          month = m

          }

        void Date::SetDay(int d) {
           
            day = d

          }

        void Date::SetYear(int y) {

          year = y

          }

        void Date::SetDate() {

          << cout << m << "/" << d << "/" << y;

          }

        void Date::ShowWithName() {

          switch (m)

          {

           case 1 : cout << "January ";
            break;
          case 2 : cout << "February ";
            break;
          case 3 : cout << "March ";
            break;
          case 4 : cout << "April ";
            break;
          case 5 : cout << "May ";
            break;
          case 6 : cout << "June ";
            break;
          case 7 : cout << "July ";
            break;
          case 8 : cout << "August ";
            break;
          case 9 : cout << "September ";
            break;
          case 10 : cout << "October ";
            break;
          case 11 : cout << "November ";
            break;
          case 12 : cout << "December ";
             break;
          }

          cout << d << ", " << y;

          }
}

I have so many errors still. Is this program even salvageable? Thanks again for the suggestions you made. I understand the concept of what I'm supposed to do (pretty much), but I am struggling to actually make it work in code. Thanks again!
why dont you have your Date constructor actually have parameters? would make a lot more sense to have a void date constructor in private and an overloaded date constructor in public.

for example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Date
{
private:
          Date();
          int mMonth;
          int mDay;
          int mYear;
public:
          Date(int m,int d int y);
          int GetDay();
          int GetMonth();
          int GetYear();
          int GetDate();

          void SetDay(int d);
          void SetMonth(int m);
          void SetYear(int y);
          void SetDate(int m, int d, int y);
          void ShowWithName(int m, int d, int y);
};

(I changed the variable names to ones that make more sense when reading the code. When naming variables, never use a single letter to name it, or others won't know what the variable is supposed to be)
To define the overloaded Date() constructor, you would simply type:
1
2
3
4
Date::Date(int m,int d,int y)
           :mMonth(m),mDay(d),mYear(y)
{
}

This will define the overloaded Date() constructor and set the variables equal to the parameters being passed. Since the void constructor of Date() is in private, no Dates can be created unless they have parameters. (wouldnt make sense to have a date with no month, day, or year).
Then, when you go to define the functions, you need to make sure you are putting semicolons at the end of the declarations.

and, you have multiple functions not even getting defined, such as getDay(), getMonth() and getYear(). you gotta define those to use them, or you will get tons of errors.

dont worry, you'll get classes figured out eventually, it just takes practice.
Last edited on
Hi!
Thanks for your help! This program is kicking my butt. When you said:

and, you have multiple functions not even getting defined, such as getDay(), getMonth() and getYear(). you gotta define those to use them, or you will get tons of errors.

I'm confused on how/where to do that. Also, do you mean I need semicolons at the end of these:

m = month

? Sorry for all the questions. Thanks again.
as far as semicolons go, take a look at my code. a semicolon is required at the end of every line of code, or the compiler doesn't know when one line stops and another starts.

without a semicolon, having code such as this:
1
2
3
int m
int x
int y

looks like this to the compiler:
 
int mint xint y

which makes no sense, and will cause a compile error.

so the correct way to write the above code is:
1
2
3
int m;
int x;
int y;


as far as defining the getMonth() getDay() and getYear() functions, you should do that in your "date.cpp" file. Ill give you an example to start out:
1
2
3
4
int Date::getMonth(void)
{
       return mMonth;
}

This would be the correct code for the getMonth() function. basically, in the definition, it simply returns the integer value that is being held by mMonth;

so when it is called by your test:
1
2
dt.setMonth(12);
cout << dt.GetMonth() << "is the month after the mutator/n";

you will get output that says "12 is the month after the mutator"

use the above definition as a model for the other get() functions, and you'll be golden. *crosses fingers*

hope that helps, im going to bed now. good luck!
Thank you! Okay, this is what I have now for the first two. I think I still have extra/incorrect stuff in the date.cpp because I'm still getting a lot of errors.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Date

{
        private:

          Date();

          int mDay;  // Day for the Date class
          int mMonth;  // Month for the Date class
          int mYear;  // Year for the Date class

        public:

          Date(int m, int d, int y);

          int GetDay();
          int GetMonth();
          int GetYear();
          int GetDate();

          void SetDay(int d);
          void SetMonth(int m);
          void SetYear(int y);
          void SetDate(int m, int d, int y);
          void ShowWithName(int m, int d, int y);
};

AND
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "date.h"

        Date::Date(int m, int d, int y)

                  :mMonth(m),mDay(d),mYear(y)


        int Date::GetMonth(void)

          {

          return mMonth;

          }

        int Date::GetDay(void)

          {

          return mDay;

          }

           int Date::GetYear(void)

          {

          return mYear;

          }

        void Date::SetMonth(int m) {

          month = m

          }

        void Date::SetDay(int d)  {

          day = d

          }

        void Date::SetYear(int y) {
          year = y

          }

        void Date::SetDate() {

          << cout << m << "/" << d << "/" << y;

          }

        void Date::ShowWithName(){

          switch (m)

          {

          case 1 : cout << "January ";
            break;
          case 2 : cout << "February ";
            break;
          case 3 : cout << "March ";
            break;
          case 4 : cout << "April ";
            break;
          case 5 : cout << "May ";
            break;
          case 6 : cout << "June ";
            break;
          case 7 : cout << "July ";
            break;
          case 8 : cout << "August ";
            break;
          case 9 : cout << "September ";
            break;
          case 10 : cout << "October ";
            break;
          case 11 : cout << "November ";
            break;
          case 12 : cout << "December ";
            break;
          }

          cout << d << ", " << y;

          }
}

Sorry to be such a pain. Thanks again for all the help you all have given! I appreciate it immensely!

Your constructor is only partly defined:
1
2
Date::Date(int m, int d, int y) 
                  :mMonth(m),mDay(d),mYear(y)

It's still waiting for its body (the code between {}). You have to provide it, even if it's empty:
Date::Date(int m, int d, int y) :mMonth(m), mDay(d), mYear(y) {}

Then, your function SetDate. Firstly, it's named in a confusing way. A setter function "should" take parameters and set private variables to those parameters (or something like it). Your SetDate function should be named "printDate" or something like that. Secondly, your usage of cout is wrong:

<< cout << m << "/" << d << "/" << y;
Should be:
cout << m << "/" << d << "/" << y;

Now, I don't actually see a reference to the std namespace. It might be in your Date.h file ("using namespace std;" or something like it, but it's not showing. If your "cout" names are unknown, add this to either file: using std::cout;

I think that should clear most/all errors.
Last edited on
Thank you! I made those changes, but still have a lot of errors. Perhaps I added the using std::cout; in the wrong spot? So here's what I have now, followed by the errors I'm getting.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Date

{
        private:

          Date();

          int mDay;  // Day for the Date class
          int mMonth;  // Month for the Date class
          int mYear;  // Year for the Date class

        public:

          Date(int m, int d, int y);

          int GetDay();
          int GetMonth();
          int GetYear();
          int GetDate();

          void SetDay(int d);
          void SetMonth(int m);
          void SetYear(int y);
          void PrintDate(int m, int d, int y);
          void ShowWithName(int m, int d, int y);
};

AND (I used the using std::cout; in this one at the top.)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "date.h"
using std::cout;

        Date::Date(int m, int d, int y)

                  :mMonth(m),mDay(d),mYear(y)

          {
          }

        int Date::GetMonth(void)

          {

          return mMonth;

          }

        int Date::GetDay(void)

          {

          return mDay;

          }

        int Date::GetYear(void)

          {

          return mYear;

          }

        void Date::SetMonth(int m) {

          month = m

          }

        void Date::SetDay(int d)  {

          day = d

          }
       
        void Date::SetYear(int y) {

          year = y

          }

        void Date::PrintDate() {

          cout << m << "/" << d << "/" << y;

          }

        void Date::ShowWithName(){

          switch (m)

          {

          case 1 : cout << "January ";
            break;
          case 2 : cout << "February ";
            break;
          case 3 : cout << "March ";
            break;
          case 4 : cout << "April ";
            break;
          case 5 : cout << "May ";
            break;
          case 6 : cout << "June ";
            break;
          case 7 : cout << "July ";
            break;
          case 8 : cout << "August ";
            break;
          case 9 : cout << "September ";
            break;
          case 10 : cout << "October ";
            break;
          case 11 : cout << "November ";
            break;
          case 12 : cout << "December ";
            break;
          }

          cout << d << ", " << y;
 }
}

AND this to test the class:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "date.h"
#include <iostream> //required for cout

using namespace std;

int main()

        Date dt;

          cout << dt.GetMonth() << "is the month after the constructor/n";

          dt.SetMonth(12);

          cout << dt.GetMonth() << "is the month after mutator/n";

          cout << dt.GetDay() << "is the day after the constructor/n";

          dt.SetDay(25);

          cout << dt.GetDay() << "is the day after mutator/n";

          cout << dt.GetYear() << "is the year after the constructor/n";

          dt.SetYear(2011);

          cout << dt.GetYear() << "is the year after the mutator/n";

          cout << dt.GetDate() << "is the date after the constructor/n";

          dt.GetDate(12/25/2011);

          cout << dt.GetDate() << "is the date after the mutator/n";

          cout << dt.ShowWithName() << "is the date shown with month name after the  constructor/n";

          dt.ShowWithName(December 25, 2011);

          dt.ShowWithName() << "is the date shown with month name after the mutator/n";

return 0;

}

ERRORS:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
date.cpp:2: error: âstd::coutâ has not been declared
date.cpp: In member function âvoid Date::SetMonth(int)â:
date.cpp:37: error: âmonthâ was not declared in this scope
date.cpp:39: error: expected â;â before â}â token
date.cpp: In member function âvoid Date::SetDay(int)â:
date.cpp:43: error: âdayâ was not declared in this scope
date.cpp:45: error: expected â;â before â}â token
date.cpp: In member function âvoid Date::SetYear(int)â:
date.cpp:49: error: âyearâ was not declared in this scope
date.cpp:51: error: expected â;â before â}â token
date.cpp: At global scope:
date.cpp:53: error: prototype for âvoid Date::PrintDate()â does not match any in class âDateâ
date.h:24: error: candidate is: void Date::PrintDate(int, int, int)
date.cpp:59: error: prototype for âvoid Date::ShowWithName()â does not match any in class âDateâ
date.h:25: error: candidate is: void Date::ShowWithName(int, int, int)
date.cpp:94: error: expected declaration before â}â token
testDate.cpp:8: error: expected initializer before âDateâ
testDate.cpp:10: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:12: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:14: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:16: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:18: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:20: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:22: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:24: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:26: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:28: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:30: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:32: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:34: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:36: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:38: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:40: error: expected unqualified-id before âreturnâ
testDate.cpp:42: error: expected declaration before â}â token

I keep changing things, but then it throws different errors. I'm at a total loss... Do I need include <iostream> somewhere else too, besides just in the driver that tests the class? Sorry for continuing to ask these questions. And thank you for all the help you've offered. Much appreciated!
You need to include <iostream> in date.cpp because you use cout in that file.
fist off, i can clear up that first error.

you need to add:
 
#include<iostream> 

at the top of your "date.cpp" file.

having "using std::cout" in there wont help without the #include

that will fix your first error, and maybe a few others.

edit:

also, in your definitions in the "date.cpp" file, you have some errors:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void Date::SetMonth(int m) {

          month = m

          }

void Date::SetDay(int d)  {

          day = d

          }
       
void Date::SetYear(int y) {

          year = y

          }

should instead be:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void Date::SetMonth(int m) {

          mMonth = m;

          }

void Date::SetDay(int d)  {

          mDay = d;

          }
       
void Date::SetYear(int y) {

          mYear = y;

          }


in your version, in the set functions, month, day, and year are completely undefined.
use the correct variable names, and those functions will work no probs. (just copy my above example, should be correct)

and once again, you needed semicolons.

hope that helps! cheers.
Last edited on
Thanks! So here's the revised date.cpp file and the errors it shows now:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "date.h"
#include <iostream>
using std::cout;

        Date::Date(int m, int d, int y)

                  :mMonth(m),mDay(d),mYear(y)

          {
          }

        int Date::GetMonth(void)

          {

          return mMonth;

          }

        int Date::GetDay(void)

          {

          return mDay;

          }

        int Date::GetYear(void)

          {

          return mYear;

          }

        void Date::SetMonth(int m) {

          mMonth = m;

          }

        void Date::SetDay(int d)  {

          mDay = d;

          }

        void Date::SetYear(int y) {

          mYear = y;

          }

        void Date::PrintDate() {

          cout << m << "/" << d << "/" << y;

          }

        void Date::ShowWithName(){

          switch (m)

          {

          case 1 : cout << "January ";
            break;
          case 2 : cout << "February ";
            break;
           case 3 : cout << "March ";
            break;
          case 4 : cout << "April ";
            break;
          case 5 : cout << "May ";
            break;
          case 6 : cout << "June ";
            break;
          case 7 : cout << "July ";
            break;
          case 8 : cout << "August ";
            break;
          case 9 : cout << "September ";
            break;
          case 10 : cout << "October ";
            break;
          case 11 : cout << "November ";
            break;
          case 12 : cout << "December ";
            break;
          }

          cout << d << ", " << y;
          }
}

And errors:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
date.cpp:54: error: prototype for âvoid Date::PrintDate()â does not match any in class âDateâ
date.h:24: error: candidate is: void Date::PrintDate(int, int, int)
date.cpp:60: error: prototype for âvoid Date::ShowWithName()â does not match any in class âDateâ
date.h:25: error: candidate is: void Date::ShowWithName(int, int, int)
date.cpp:95: error: expected declaration before â}â token
testDate.cpp:8: error: expected initializer before âDateâ
testDate.cpp:10: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:12: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:14: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:16: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:18: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:20: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:22: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:24: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:26: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:28: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:30: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:32: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:34: error: expected constructor, destructor, or type conversion before â<<â token
testDate.cpp:36: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:38: error: expected constructor, destructor, or type conversion before â.â token
testDate.cpp:40: error: expected unqualified-id before âreturnâ
testDate.cpp:42: error: expected declaration before â}â token

Thanks for helping me get rid of some of the errors! (I can't believe I'd still forgotten the semicolons!) So, now I'm wondering if I flubbed up how I defined the PrintDate and ShowWithName in the date.h file or something. And my test/driver file errors...wow... I thought I had that file correct, but it's like it doesn't recognize the Date dt; that I used to create the date constructor in that file. Thanks again for all of your help!
Okay, just fixed some of my stupid mistakes and getting less errors now. Thanks so much for all of your help! The only errors I'm getting now are for the ShowWithName, PrintDate in all 3 files (no matching function to call and not matching class across the 3 files) and Date::Date file being private. Gonna keep plugging away at it. Thanks again!
My bad, I forgot to add the ';' at the end of my constructor example. That's probably what caused most of the errors in your last post? :/

In the case of PrintDate():
According to the last posted version of the header file, it requires 3 arguments, but the definition in your .cpp file has zero arguments. Make sure to be consistent!
(Note: a class member function can always access the object's member variables, so no need to pass them as arguments!)
Thanks for the reply! Ok, added that semicolon. Thanks! Actually, I think most of those errors in my last post were because I was missing a { in my test file? I hate it when I do that! Yesterday I added the 3 arguments to the PrintDate, ShowWithName, etc. in my cpp file. But it seems most of my problems stem from my testDate file errors saying no matching function for call in those GetDate and ShowWithName files.
(Note: a class member function can always access the object's member variables, so no need to pass them as arguments!)
A little confused on this, but I hope to figure it out. Thanks again! :)
Topic archived. No new replies allowed.