Search code examples
c++constructorinlinemember-functions

Are user defined constructors and member functions inline by default?


Let's have

class ClassA
{
public:
ClassA() = delete;
ClassA(int InObjectID):ObjectID(InObjectID){};
int GetID(){return ObjectID;};
private:
const int ObjectID;
}

a. Is the function ClassA(int) inline by default?

b. Is the function GetID(void) inline by default?


Solution

  • a. Is the function ClassA(int) inline by default?

    b. Is the function GetID(void) inline by default?

    Yes. Member functions that are defined within the class definition are implicitly inline.