hi i just have made add function yet for complex calculator but its not working
in this function i just want to add real in real part and complex in complex part but compilor says
error C2065: 'o1' : undeclared identifier
error C2228: left of '.real' must have class/struct/union
error C2228: left of '.complx' must have class/struct/union
i think i am missing something kindly guide me here is my code
Code:
# include <iostream>
# include <conio.h>
# include <windows.h>
using namespace std;
class complex
{
private:
	double real;
	double complx;
public:
	complex ()
	{
	
	}// defualt constructor
	complex (double r1,double r2) 
	{
		real=r1;
		complx=r2;
	
	}//end constructor 2

	void add (complex o)
	{
		
		real=o.real+o1.real;
		complx=o.complx+o1.complx;
		
	
	}//end function
	


};//end class
int main ()
{
	const complex o(2,4),o1(4,6);
	complex o3;
	o3.add (o1);
	getch ();
	

}//end main
thanks