193k views
0 votes
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

User Pogopaule
by
7.8k points

1 Answer

2 votes

Answer:

7

Step-by-step 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.

User Harish Sharma
by
8.2k points