c++ programming problem1

Hi!
I'm quite new to c++ i write a code for c ++ constructor.I just want to use two constructor . and see the difference the code is following
code:
#include<stdio.h>
#include<iostream>
using namespace std ;

class uncle
{
public: uncle();
public : uncle( int x,int y);

char a[25];
char b[22];
};
int main ()
{
uncle u,v;
u=new uncle();
v=new uncle(4,5);
cout<<"the value of frist constructer\n\n";
cout<< u.a;
cout<<"\n"<<u.b;
cout<<"the value of second constructer\n\n";
cout<< v.a;
cout<<"\n"<<v.b;
return 0;
}
uncle::uncle()
{ a="manish";
b="yadav";
}
uncle :: uncle(int x, int y);
{a="mahesh";
b="khatodia";
}


But it shows error . as i told u i'm new to c++ what are these error why are they coming :

errors:

co.cpp: In function ‘int main()’:
co.cpp:17: error: no match for ‘operator=’ in ‘u = (operator new(47u), (<statement>, ((uncle*)<anonymous>)))’
co.cpp:6: note: candidates are: uncle& uncle::operator=(const uncle&)
co.cpp:18: error: no match for ‘operator=’ in ‘v = (operator new(47u), (<statement>, ((uncle*)<anonymous>)))’
co.cpp:6: note: candidates are: uncle& uncle::operator=(const uncle&)
co.cpp: In constructor ‘uncle::uncle()’:
co.cpp:29: error: incompatible types in assignment of ‘const char [7]’ to ‘char [25]’
co.cpp:30: error: incompatible types in assignment of ‘const char [6]’ to ‘char [22]’
co.cpp: At global scope:
co.cpp:33: error: declaration of ‘uncle::uncle(int, int)’ outside of class is not definition
co.cpp:34: error: expected unqualified-id before ‘{’ token


All i want is to do when i use first constructor it show me the value manish and yadav and when i call the secon constructor it show me value mahesh and kumar

there may be some syntactic mistake in the code but all i want to know the logical error in code,
what I'm doing wrong ?
please help me

Last edited on
Please use [code][/code] tags and proper indentation.
This uncle u,v; must be uncle *u,*v; // Note that '*' (pointers) then the access is u->a

and use code tags like webJose suggested
Topic archived. No new replies allowed.