Click here to Skip to main content
15,903,362 members

Comments by NaumanMalik (Top 25 by date)

NaumanMalik 1-Dec-20 17:04pm View    
void Date::retrieveDate(int &a, int &b, int &c)const
{
a = Day;
b = Month;
c = Year;
}
I did it. it was just confusing for me what should I do in its body plus I have not done this so that is why I was asking
NaumanMalik 1-Dec-20 15:01pm View    
I'm really sorry if I'm not clearing my point. Actually it is my assignment question and I am writing its code but I am unable to figure out how am I going to retrieve date attributes
void retrieveDate(int &, int &, int &) const; // retrieve Date attribute values
like this in above reply ....You can't even change the prototype...
NaumanMalik 1-Dec-20 14:03pm View    
#include<iostream>
using namespace std;

class Date
{
bool validateDate(); // Validate attribute range values – methods can also be private. You can use this to check validity.
int Day;
int Month;
int Year;
public:
Date(); // initialize attributes with default values
~Date();
Date(int, int, int);// if invalid, set default date or set equal to system date
Date(const Date &);
bool inputDate(); /* assign values to Date attributes (cin from user),
return true if valid range of values are input */
bool copyDate(Date &); // return true if date was valid and copied successfully.
bool inputCompleteDate(int, int, int); // return true if date was valid and was set successfully.
Date &getDate() const;
void retrieveDate(int &, int &, int &) const; // retrieve Date attribute values
void showDate() const; // Display Date attribute values
bool isEqual(Date &); // return true if both dates are equal, (hint: one is already present as this pointer)
int daysBetween(Date &); // return days elapsed between two Dates
int operator - (Date &); // return days elapsed between two Dates. Yes its above function but with operator overloading
// All other relevant methods go here, setter/getter etc

};
this is my question to write bodies of functions of this header file and implement it in main.cpp... I think you will get the question, if not then I can't have anything else to state... i asked my teacher about this... he said you have to set values

I also tried this way but it is also giving errors:
void Date::retrieveDate(int &a, int &b, int &c) const Day(a), Month(b), Year(c);
{

}
NaumanMalik 6-Jul-20 4:56am View    
Welcome by the way i am new so i am sorry for not rating comments
NaumanMalik 6-Jul-20 4:37am View    
okay on it