Inline member function

How does a compiler treat an inline member function of a class? (11)

Consider the definition of the following

class: (1, 2, 3, 5, 7, 11) 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, return (num1 + num2) / x;

  //Otherwise, return num1 - num2 + x;

bool equal()  return (num1 == num2);

myClass()

myClass(int x, int y);

  //Constructor with parameters.

  //Postcondition: num1 = x; num2 = y;

 private:        int num1 = 0;

int num2 = 0; ;

a. Which member functions of the class myClass are inline.

b. Write the definitions of the member function of the class myClass which are not inline.

c. Write a program to test the class myClass.

d. Rewrite the definition of the class myClass so that the function set and the constructor with parameters are inline.

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X