+ 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?
3 Respostas
+ 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.
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)
0
There's a search algorithm to begin with, for finding a function, since it's at a different place in the code.