I
ineedyourluvin1
Hi, I would appreciate if someone could tell me what
I'm doing wrong ?
#include<iostream>
using namepace std ;
struct person{
char *firstname ;
int age ;
} ;
struct person1{
char *firstname ;
int age ;
} ;
int main(int argc, char *argv[])
{
person me ;
person1 me1 ;
me.firstname = "me" ;
me.age = 150 ;
me1 = me ; // here's where the problem occurrs.....
*The Error Report I Get*
(structs.cpp: in function 'int main()':
structs.cpp:22: error: no match for 'operator=' in 'me1 = me'
structs.cpp:11: error: candidates are: main():erson1&
main():erson1:perator=(const main():erson1&)
structs.cpp:29:1: warning: no newline at end of file
)
Why can't I assign a struct to a struct like i can an int to an int, or
a char to a char, etc ? I can understand it would become
a problem if each struct had different members but these two don't!
thankyou much
I'm doing wrong ?
#include<iostream>
using namepace std ;
struct person{
char *firstname ;
int age ;
} ;
struct person1{
char *firstname ;
int age ;
} ;
int main(int argc, char *argv[])
{
person me ;
person1 me1 ;
me.firstname = "me" ;
me.age = 150 ;
me1 = me ; // here's where the problem occurrs.....
*The Error Report I Get*
(structs.cpp: in function 'int main()':
structs.cpp:22: error: no match for 'operator=' in 'me1 = me'
structs.cpp:11: error: candidates are: main():erson1&
main():erson1:perator=(const main():erson1&)
structs.cpp:29:1: warning: no newline at end of file
)
Why can't I assign a struct to a struct like i can an int to an int, or
a char to a char, etc ? I can understand it would become
a problem if each struct had different members but these two don't!
thankyou much