I have a code that seems to be error free but I am getting this warning
C26495: Variable '_date::year' is uninitialized. Always initialize a member variable (type.6).
It also says +3 overloads
for the constructor in the same warning. Why am i getting this warning. I have looked online but cannot figure out what is the cause of this. It seems to be related to the constructor. Do i need to declare additional constructors or change the signature of constructor? here is my code
_date.h header file
#pragma once
#include <iostream>
using namespace std;
//definition for class date
class _date
{
int day;
int month;
int year;
public:
_date(int day = 0, int month = 0, int year = 2020);
_date(int day, int month);
bool check_date_validity();
};
_date.cpp file
#include "_date.h"
_date::_date(int day_value, int month_value) : day { day_value }, month{ month_value }
{
}
// and additional function definitions