1. We can default arguments to add now parameters to the exiting functions.
2.Default arguments can be used to cobine similar functions in to one.
FUNCTION OVERLOADING OR FUNCTION POLYMORPHISAM:
Function polymorphism also called funcrtion overloadinfg lets use multiple function sharing the same name.The expression polymorphism means havinfg many forms so function pholymorphism lets have many form similarly
The expression function overloading means you can attach more then one function to be the same name,thus function overloading to design a family of functions that to essentially the same thing but using different argument lists.Overloading of the functions should be done with caution .We should not overload unrelated functions and should reserve function overloading for functions that perform closely related tasks .Sometimes,the default arguments may be used instead of overloading .This may reduce the number of functions to be defined.The correct functions to be invoked is determine by cheking the number and type of arguments and than calls the appropriate functionafor execution .A best match must be unique.The function selection involves the following steps
Friday, August 7, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment