0

I'm reading testRTSPClient.cpp at live555 library for read RTSP stream At a constructor's implementation of DummySink, i meet a strange syntax

    DummySink::DummySink(UsageEnvironment& env, MediaSubsession& subsession, char const* streamId)
      : MediaSink(env),
        fSubsession(subsession) {
      fStreamId = strDup(streamId);
      fReceiveBuffer = new u_int8_t[DUMMY_SINK_RECEIVE_BUFFER_SIZE];
    }

I don't understand what

: MediaSink(env),  
fSubsession(subsession)

that after function prototype means, because common function defining syntax is

functionName(args)
//without :
{
//implement
}

If anyone know about it, please tell me know. Thank you so much

Viettel Solutions
  • 1,519
  • 11
  • 22
  • 7
    This is not strange, unusual or advanced syntax. It is very basic syntax for constructors. It should be explained in any introduction to the language. – user17732522 Feb 08 '22 at 10:56
  • 5
    _"because common function defining syntax is ..."_ - No, I would say that using the member initializer list is the most common way to initialize base classes and member variables. – Ted Lyngmo Feb 08 '22 at 10:58

0 Answers0