I have been to trying to fix the below code for the last one hour without any success. Could you help me, please? I was trying to compile it in Code::Blocks. Thanks for the help.
You can't call this from student because it belongs to the Date class. You would have to create a Date object as a member of student and call the readDate method on that.
You can't call this from student because it belongs to the Date class. You would have to create a Date object as a member of student and call the readDate method on that.
The problem is I don't know how to do this. I have made one correction you suggested.
mik2718: Yes, you are correct. Thanks. I have fixed it.
I still have few errors to fix.
Errors:
1 2 3 4 5 6 7 8 9 10 11 12
In function 'int main()':|
41|error: 'Date' was not declared in this scope|
41|error: expected ';' before 'date'|
In member function 'void Student::readStudent()':|
58|error: 'readDate' was not declared in this scope|
59|error: expected primary-expression before '(' token|
59|error: expected primary-expression before 'int'|
59|error: expected primary-expression before 'month'|
59|error: expected primary-expression before 'int'|
In member function 'void Student::printStudent()':|
68|error: 'date' was not declared in this scope|
||=== Build finished: 8 errors, 0 warnings ===|
Date is not accessible in the main scope since it is private to Student.
Hi
I understand that it's one of the main errors and I also know Date isn't accessible inside the main. But the issue is I don't know what to do to fix it. :(
Yes, there would be different ways to do this problem. But I'm interested to do it this way because it seems the difficult one. :)