Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6794485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:13:40+00:00 2026-05-26T18:13:40+00:00

I have a class Date that I defined that models a date, it has

  • 0

I have a class Date that I defined that models a date, it has a day,month and a year as data members. Now to compare the dates I created the equality operator

bool Date::operator==(const Date&rhs)
{
    return (rhs.day()==_day && _month==rhs.month() &&_year==rhs.year());
}

Now how do I call the Date class equality operator from the Proxy class…??


This is the edited part of the question

This is the Date Class

//Main Date Class
enum Month 
{
    January = 1, 
    February,
    March, 
    April,
    May,
    June,
    July, 
    August, 
    September,
    October,
    November, 
    December
};
class Date
{
public: 

    //Default Constructor
    Date();
    // return the day of the month
    int day() const
    {return _day;}
    // return the month of the year
    Month month() const
    {return static_cast<Month>(_month);}
    // return the year
    int year() const
    {return _year;}

    bool Date::operator==(const Date&rhs)
    {
    return (rhs.day()==_day && _month==rhs.month() &&_year==rhs.year());
    }

    ~Date();

private:
    int _day;
    int _month;
    int _year;

}

//--END OF DATE main class

This is the proxy class that I will substitute for the Date class

//--Proxy Class for Date Class
class DateProxy
{
public: 

    //Default Constructor
    DateProxy():_datePtr(new Date)
    {}
    // return the day of the month
    int day() const
    {return _datePtr->day();}
    // return the month of the year
    Month month() const
    {return static_cast<Month>(_datePtr->month());}
    // return the year
    int year() const
    {return _datePtr->year();}

    bool DateProxy::operator==(DateProxy&rhs)
    {
        //what do I return here??
    }

    ~DateProxy();

private:
    scoped_ptr<Date> _datePtr;

}

//--End of Proxy Class(for Date Class)

Now the problem that I am having is implementing the equality operator function in the proxy class, I hope this clarifies the question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:13:40+00:00Added an answer on May 26, 2026 at 6:13 pm
    return *_datePtr == *_rhs.datePtr;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django model that contains a date field: class Event(models.Model): event_date =
We currently have a utilities class that handles a lot of string formatting, date
I have the following class: public class Day { public int Date { get;
I have a report model looking a bit like this: class Report(models.Model): date =
I have a model which has a field status definde as: class Model(models.Model): ...
I have a Task model where every task has deadline. class Tasks(models.Model): assigned_to =
I have a SQL Server DB table that has a column ReceivedDate defined as
I have a class that has 3 properties: class Three { int ID {
I have a Django model called Event that has a date field for the
I have a class User with one field called birthDate which is a java.sql.Date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.