Search code examples
c++classsyntaxmember

meaning of ** within c++ class declarations


I am confused by the usage of a double asterisk postpended to a class type in C++.

A paraphrase of the code I am reading would be

class ThisClass : protected SuperClass
{
  public:
    void MemberFunction(ThisClass** identifier);
}

I understand that ThisClass* identifier, with one asterisk, means that identifier is a pointer to an instance of ThisClass. Is ** a repeated round of 'pointing', or has an altogether different meaning?

How should I interpret the argument of the member function?


Solution

  • Is ** a repeated round of 'pointing',

    Yes, it signifies that identifier's type is pointer-to-pointer-to-ThisClass, i.e. that is points to a ThisClass* object, which is itself a pointer-type object (pointing to a ThisClass object).

    or has an altogether different meaning?

    No, no special meanings.


    Similarly in an expression ** signifies repeated dereferencing.