Constructor Inheritance, kinda
Hmm another question.
This code snippet is from here. Friend Functions (C++)
If you direct your attention to the red you see this
What exactly does that mean? At first i thought it was for inheriting the constructor of a class. But then i look down further and see the m_i, is an integer variable and not a class constructor. Thus my confusedness at the moment. Could someone please explain what exactly just occurred back there. Thanks >_<
Code:
// friend_functions.cpp
// compile with: /EHsc
#include <iostream>
using namespace std;
class Point
{
friend void ChangePrivate( Point & );
public:
Point( void ) : m_i(0) {}
void PrintPrivate( void ){cout << m_i << endl; }
private:
int m_i;
};
void ChangePrivate ( Point &i ) { i.m_i++; }
int main()
{
Point sPoint;
sPoint.PrintPrivate();
ChangePrivate(sPoint);
sPoint.PrintPrivate();
}
If you direct your attention to the red you see this
Code:
Point( void ) : m_i(0) {}