What is difference between function overloading and overriding?
Answer / niraj verma
It is possible in C++ to use the save function name for the
no of lines for different intention. Defining multiple
function with same name is know as function overloading or
function polymorphism.
Polymorphism means one function having many forms.
The overloading function must be different in its argument
list and with different data types.
Example:
#include<iostream.h>
#include<conio.h>
int square (int);
float square (float);
void main()
{
int a = 5;
float b = 2.5;
clrscr();
cout<<"square = "<<square(a);
cout<<"\n square = "<<square(b);
getch();
}
int square(int s)
{
return (s*s);
}
float square (float j)
{
return (j*j);
}
Overloading;
| Is This Answer Correct ? | 9 Yes | 1 No |
How do you make derived class as an abstract class?
WHAT IS ABSTRUCT DATA TYPE ? PLEASE EXPLAIN IT.
What is a linked list?
why to use template classes in c++?
How Do you Code Composition and Aggregation in C++ ?
which structured data type is not used in c++? 1.union 2.structure 3.string 4.boolean
What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass
different types of castings
The type of variable a pointer points to must be the part of pointer's definition so that:
what is virtual destructor
swapping program does not use third variable
What is abstraction in oops with example?