question

why it does not run ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
#include<string>
using namespace std;
class mark{
public:
int point;
mark();
mark(int m){
	point=m;
}
mark operator+(mark obj){
mark b;
b.point=point+obj.point;
return (b);
}
};

int main(){
mark obj1(2);
mark obj2(6);
mark obj3=obj1+obj2;
cout<<"the result wiull be "<<obj3.point;



system("pause");
return 0;
}
@line 7 you declared a default constructor without defining it.

mark(){};
thank u so much
Topic archived. No new replies allowed.