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
- 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; };
- Which member functions of the class myClass are inline.
- Write the definitions of the member function of the class myClass which are not inline.
- code a program to test the class myClass and share your results with the class.
- 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
Get step-by-step solutions from verified subject matter experts
