The private member variables

The private member variables.

Find the error(s) in the following code:  (8, 9)

template      //Line 1

class strange             //Line 2

    .

    .

    .

;         

strange s1;          //Line 3

strange s2;         //Line 4

Consider the following declaration: (8, 9)

template

class strange

   .

   .

   . private:    type a;

    type b;

;

a. Write a statement that declares sObj to be an object of type strange such that the private member variables a and b are of type int.

b. Write a statement that shows the declaration in the class strange to overload the operator == as a member function.

c. Assume that two objects of type strange are equal if their corresponding member variables are equal. Write the definition of the function operator== for the class strange, which is overloaded as a member function.

The private member variables

Posted in Uncategorized

Leave a Reply