+ 1

Can anybody tell me the actual use of over riding in C++

26th Feb 2017, 5:30 AM
Sahil Gurnani
Sahil Gurnani - avatar
2 ответов
+ 1
Suppose you have to find the area of a rectangle and a circle and you are asked to create a function named area. Here you have two choices one is two make two separate function with different names and second is to override. Here it may seem that either doesnt make much difference but think of an organisation working on thousands of line of code.Naming the functions doing the same task(calculating area here) different will make the whole code a mess and debugging will be very painful. Hence to overcome this we name both the function the same and make changes in the implemetation part. this make the code look clean and understandable
26th Feb 2017, 8:57 AM
Mohd Danish
Mohd Danish - avatar
+ 1
thanks buddy
27th Feb 2017, 10:10 AM
Sahil Gurnani
Sahil Gurnani - avatar