Examine the class definition. How many members does it contain?

class clockType
{
public:
void setTime(int, int, int);
void getTime() const;
void printTime() const;
bool equalTime(const clockType&) const;
private:
int hr;
int min;
int sec;
};
(Points : 5) 7
3
4
None of the above

Respuesta :

Answer:

7

Explanation:

The class clockType consists of three member variables marked as private:

  • int hr;
  • int min;
  • int sec;

It also contains four public member functions:

  • void setTime(int, int, int);
  • void getTime() const;
  • void printTime() const;
  • bool equalTime(const clockType&) const;

So in total it contains seven members. The member variables constitute attributes or state of the object while the member functions represent possible operations on the object.