adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include 
    using namespace std;
    class Distance
    {
        private:
        int feet;
        int inches;
        public:
        Distance()
        {
            feet = 0;
            inches = 0;
        }
        Distance(int f, int i) 
        {
            feet = f;
            inches = i;
        }
        Distance operator()(int a, int b, int c)
        {
            Distance D;
            D.feet = a + c + 10;
            D.inches = b + c + 100 ;
            return D
        }
        void displayDistance()
        {
            cout  << feet <<  inches << endl;
        }
    };
    int main()
    {
        Distance D1(11, 10), D2;
        cout << "First Distance : ";
        D1.displayDistance();
        D2 = D1(10, 10, 10);
        cout << "Second Distance :";
        D2.displayDistance();
        return 0;
    }

a.

First Distance : 1110 Second Distance :30120

b.

First Distance : 110 Second Distance :3020

c.

First Distance : 1115 Second Distance :30125

d.

none of the mentioned

Answer: (a).First Distance : 1110 Second Distance :30120

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?