Posted By:
3 Jul, 2013 12:54 pm PDT

Functions in C++

What are functions? How to implement functions?

       In C++, two functions can have the same name if their parameter type or number is different. The property of the function to have same name is known as overloading. Hence functions can be overloaded if they either have a different parameter type or different number of parameters.

For example


int volume(int l,int b,int h)


int vol;                                                               ‘volume’ function with 3 parameters


return vol;




int volume(int b,int h)


int vol;                                                                       ‘volume’ function with 2 parameters


return vol;


void main()


int v1,v2;



cout<<”\nVolume of rectangle:”<<v1;

cout<<”\nVolume of cone:”<<v2;


Was it useful?  

Please login to reply to this problem.