C++ implicitly calling a function When? and How?

c++, theory

Solution

Are all functions inside of a class member functions? or only the ones preceded by the declaration "friend"?

Friend functions are not member functions. All what they differ from regular global functions is that they can access non-public area of the class. For example:

class myclass
{
    friend void fun(const myclass& obj);
    int x;
};

void fun(const myclass& obj)
{
    std::cout << obj.x; // x is private member
}

What is the difference between an implicit and explicit call?

When you call a function using the `() operator`, it is an explicit call. If you don't do it that way, it is an implicit one. Example of an explicit call:

fun();

Examples of implicit calls:

void someScope(){
    myclass myobject; // constructors called

} // destructor of myobject is called before exiting the function
....
myclass* mySecondObject = new myclass; // constructor called
delete mySecondObject; // destructor called

Problem

I have a couple questions. Are all functions inside of a class member functions? or only the ones preceded by the declaration "friend"? The significance of member functions are that they cannot be accessed by any other classes correct? What is the difference between an implicit and explicit call? Which functions can or cannot be implicitly called? I was hoping to see an example of implicit and explicit calling. EDIT: Thanks for the great answers, there were lot of bits and pieces that answered my question and thanks for the links to the books. I will read them.

Original source