+ 1

C and C++ comparing

I have learned C programming language for 2 years from nothing to everything, I didnt know anything about programming, I have also learned C++ (Object oriented) for 6 months.In C, you cant create two functions with the same name, but in C++, as long as you change the parameters and returning type, you can create many of functions with the same name.The question is that are there any disadvantages of this which is about runtime and compile time?

10th Jan 2019, 12:09 AM
Ercan Dalmış
Ercan Dalmış - avatar
3 odpowiedzi
+ 2
Not really. It's just that each is it's own function, meaning that adding 20 functions with the same name, but different parameters and such, is the same as adding 20 differently named functions in C.
10th Jan 2019, 1:08 AM
Rain
Rain - avatar
0
I mean, there must be a search algorithm.If it takes 2 parameters , programme’s itself must be searching the right function.isn’t it gonna affect the run-time?(Assume that the programme is a big one)
10th Jan 2019, 3:45 PM
Ercan Dalmış
Ercan Dalmış - avatar
0
There's a search algorithm to begin with, for finding a function, since it's at a different place in the code.
10th Jan 2019, 4:28 PM
Rain
Rain - avatar