#include <iostream>
using namespace std; 

struct MyClass {
	int n;
	int bar() const { return n; }
};  

int foo(MyClass const* aPtr = 0) {
    MyClass const& a = aPtr ? *aPtr : MyClass(); // Either bind to *aPtr, or to a default-constructed MyClass
    cout << "a refers to "<< (void*)&a<<" ";
    return a.bar();
}

int main() {
	MyClass mya; 
	cout << "With nullptr: "; 
	foo();
	cout <<endl<<"With object " << (void*)&mya<<": ";
	foo(&mya);
    cout << "\nIf the object pointer and the referred pointer are different, a is not bount to the original object\n";
}
