I have programmed in c++ for a couple of months, and I am starting to understand the core. At the moment I am trying to make a calender program with classes and inheritance (just to get more comfortable with object oriented programming), and a few weeks ago I learned about operation overloading.
I am wondering, is it a bad idea to overload parantheses for an object, such that I could for instance write this, or can an error occure becuase the compiler can confuse it for something else(constructor or something like that)?
//creating a valid year-object
Year year1998 = Year(1998,true);
// the parantheses operator returns a day(another object)
Day d = year1998(1,10);
//the overloading
Day& Year::operator()(int monthNumber, int dayNumber){
//Just returns a day from the month class
return months[monthNumber][dayNumber];
}