What does 'return *this' mean in C++?

后端 未结 6 580
盖世英雄少女心
盖世英雄少女心 2020-12-13 16:44

I\'m converting a C++ program to C#, but this part has me confused. What does return *this mean?

template< EDemoCommands msgType, typename PB_OBJECT_TYPE          


        
6条回答
  •  猫巷女王i
    2020-12-13 17:05

    this means pointer to the object, so *this is an object. So you are returning an object ie, *this returns a reference to the object.

提交回复
热议问题