Ask Question
25 April, 13:27

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. 25 April, 14:25
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers