[ create a new paste ] login | about

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

C++, pasted on Jun 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream.h>
class A {
public:
	A(int i):r1(i)  		{ cout<<r1<<endl; }
	~A()    		{ cout<<"~"<<r1<<endl; }
	void print() 		{cout<<"Empty:"<<r1<<endl;}
	void print() const 	{cout<<"Const:"<<r1<<endl;}
	void print(int x) 	{cout<<"Param:"<<x*x<<endl;}
private:
	int r1;
};
int main() {
	A a1(1),a2(2);
	a1.print();
	a2.print(3);
	return 0;
}


Output:
1
2
Line 5: error: stray '\343' in program
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: