Question: 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

  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. Write the definitions of the member function of the class myClass which are not inline.
  3. code a program to test the class myClass and share your results with the class.
  4. Rewrite the definition of the class myClass so that the function set and the constructor with parameters inline.

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!