This is a simply program for date but i don't understand why it shows this errors
main.cpp
1 2 3 4 5 6 7 8 9 10 11
#include<iostream>
#iclude"Date.h"
usingnamespace std;
void main (){
int y;
Date today(17, 11, 2018);
y =today.Day;//Why this doesn't work?
cout <<y;
}
Date.h
1 2 3 4 5 6 7 8 9 10 11 12
class Date
{
int day;
int month;
int year;
public:
Date(int x, int y, int z);
int Day(int x) { return day; }
int Month(int x) { return month; }
int Year(int x) { return year; }
1 2 3 4 5 6 7 8 9 10
#include"Date.h"
Date::Date(int x, int y, int z)
{
day = x;//Not checking anything,most simplest way
month = y;
year = z;
}
State
Error C3867 'Date::Day': non-standard syntax; use '&' to create a pointer to member What does this mean?
Severity Code Description Project File Line Suppression State
Error C2440 '=': cannot convert from 'int (__thiscall Date::* )(void)' to 'int' and this error