Question: C++ Only Consider the following code and answer the questions: class myClass { public: void set(int x, int y); //Function to set the values of

C++ Only

  1. Consider the following code and answer the questions:

class myClass { public: void set(int x, int y); //Function to set the values of num1 and num2. //Postcondition: num1 = x; num2 = y; void print() const; //Function to output the values of num1 and num2; int compute( int x); //Function to return a value as follow; //if x > 0, retunr (num1 + num2) / x; //Otherwise, return num1 - num2 + x; bool equal() { return (num1 == num2); } myClass() { myClass(int x, inty); } private: int num1 = 0; int num2 = 0; };

  1. Which member functions of the class myClass are inline.
  2. The definitions of the member function of the class myClass which are not inline.
  3. A program to test the class myClass.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!