Ask Question
19 June, 14:56

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.

+1
Answers (1)
  1. 19 June, 15:12
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers