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

后端 未结 6 568
盖世英雄少女心
盖世英雄少女心 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条回答
  •  失恋的感觉
    2020-12-13 17:02

    You are just returning a reference to the object. this is a pointer and you are dereferencing it.

    It translates to C# return this; in the case that you are not dealing with a primitive.

提交回复
热议问题