Home

Search IconIcon to open search

C++ Classes

If a method doesn’t change the object’s fields, write const in the end:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class Time {
private:
  int hours;
  int minutes;
  int seconds;

public:
  Time(int h, int m, int s);

  int GetHours() const;
  int GetMinutes() const;
  int GetSeconds() const;
};