A class constructor.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
TinyGPS::TinyGPS()
  :  _time(GPS_INVALID_TIME)
  ,  _date(GPS_INVALID_DATE)
  ,  _latitude(GPS_INVALID_ANGLE)
  ,  _longitude(GPS_INVALID_ANGLE)
  ,  _altitude(GPS_INVALID_ALTITUDE)
  ,  _speed(GPS_INVALID_SPEED)
  ,  _course(GPS_INVALID_ANGLE)
  ,  _hdop(GPS_INVALID_HDOP)
  ,  _numsats(GPS_INVALID_SATELLITES)
  ,  _last_time_fix(GPS_INVALID_FIX_TIME)
  ,  _last_position_fix(GPS_INVALID_FIX_TIME)
  ,  _parity(0)
  ,  _is_checksum_term(false)
  ,  _sentence_type(_GPS_SENTENCE_OTHER)
  ,  _term_number(0)
  ,  _term_offset(0)
  ,  _gps_data_good(false)
#ifndef _GPS_NO_STATS
  ,  _encoded_characters(0)
  ,  _good_sentences(0)
  ,  _failed_checksum(0)
#endif
{
  _term[0] = '\0';
}


I am wondering about the constructor. I see there appears to be nothing inside of TinyGPS::TinyGPS() as far as parameters go and that that declaration is followed by a ":". First I'm wondering as to the meaning of the colon. As well with the variables defined after the ":" I see some "(0)" and I am wondering as well to the exact meaning of the "(0)". Are those variables being defined as parameters separated by ","?
This is a constructor. Each name in the comma-separated list after the colon is the name of a member of the class that's being constructed. For each member, the values in the parentheses is the initial value of the member.
Thank you. That answers my question very well.
Topic archived. No new replies allowed.