[ create a new paste ] login | about

Link: http://codepad.org/EIbxTNVw    [ raw code | output | fork ]

GiM - C++, pasted on Jul 14:
#include <cstdio>

class A {
	int x;
public:
	A(int shmoo) { x = shmoo; }
	void bar() const { printf ("A.bar() x: %d\n", x); }
};

class B {
	const A& a;
public:
	B(const A& refA) : a(refA) {
	}

	void foo() { a.bar(); }
};

int main() {
	//A abbe(100);
        //B babe(abbe);
	B babe(A(100));

	babe.foo();

	return 0;
}


Output:
1
A.bar() x: 100


Create a new paste based on this one


Comments: