Friday, May 26, 2017

C++ what is a non static member function?

it is a function without const or friend specifier and that is declared in a member specification. 
Below gives some good overview of various types of member functions 

class S 
{
int mf1(); //non static member function declaration 
void mf2() volatile, mf3() &&; //can be cv-qualified and reference-qualified
        int mf4() const {return data;} //can be defined inline
virtual void()  mf5() final; //can be virtual can use virtual/final 
        S() : data(12) {} // constructors are member functions as well. 
        int data;
};

int S::mf1() {return 6;} //if not defined inline, it has to be defined at namespace. 

references:

No comments:

Post a Comment