Ask Question
23 December, 01:28

Write the statement that includes a friend function named before in the class dateType that takes as parameters two objects of type dateType and returns true if the date represented by the first object comes before the date represented by the second object; otherwise, the function returns false.

+2
Answers (1)
  1. 23 December, 02:54
    0
    In opp friend function is a function that gives the same access to private and protected data. It is declared in class that is granting access.

    Explanation:

    #include

    using namespace std;

    class Sum

    {

    int a, b, add;

    public:

    void input ()

    {

    cout << "Enter the value of l and m:";

    cin >> l>>m; taking input from users

    }

    friend void add (sum &t);

    void display ()

    {

    cout << "The sum is : " << z;

    }

    };

    void add (sum & p)

    {

    p. add = p. a + p. b;

    }

    int main ()

    {

    sum p1;

    p1. input ();

    add (p1);

    p1. display ();

    return false;

    if (display==5)

    {

    return true; / /true is returned if sum is equal to 5

    }

    else / /if they are not the same

    {

    return false;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write the statement that includes a friend function named before in the class dateType that takes as parameters two objects of type ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers