constructive function error

hello friends, when i write this code,why i get this error: no matching function for call to 'sekil::sekil()'

if i add sekil()
{
}
to class sekil is working but why i am getting error

thank you

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
29
30
31
32
33
34
35
36
37

class sekil

{	
public :


sekil(int b)
{
	cout<<"veysel"<<endl;
}
};
class ucgen:public sekil

{
	public:
		ucgen():sekil(7)
		{
					cout<<"olgun"<<endl;

		}
ucgen(int c)
		{
					cout<<"hello"<<endl;

		}
};



int main(int argc, char** argv) {
	

ucgen z;
	
	return 0;
} 
Last edited on
You can only use functions that exist.

This function
1
2
3
4
ucgen(int c)
{
  cout<<"hello"<<endl;
}

tries to use the default constructor of sekil to create its sekil base object. It tries to use the default constructor because you didn't specify what constructor to use.

The default constructor of sekil is sekil() , which does not exist.

You cannot use functions that don't exist.
Can you see your code? Are you satisfied with how it looks? Maybe try using code tags:

[code]
your code goes between the tags
[/code]
hello tpb, sorry for how looks my code i fixed my code.

hello repeater if i understand you correctly you mean that right ?

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
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <string>
using namespace std;
class sekil

{	
public :


sekil(int b)
{
	cout<<"veysel"<<endl;
}
};
class ucgen:public sekil

{
	public:
		ucgen():sekil(7)
		{
					cout<<"olgun"<<endl;

		}
ucgen(int c):sekil(9)
		{
					cout<<"hello"<<endl;

		}
};



int main(int argc, char** argv) {
	

ucgen z;
	
	return 0;
}
Last edited on
Topic archived. No new replies allowed.