What is function overloading?,describe it with the example.
Answer Posted / yasir
OverRIDING:
Signature remains the same, the implementing class just writes its own functionality.
int addition(int a, int b)
{
int c;
c = a * b;
return c;
}
changes to
int addition(int a, int b)
{
c = (a + b)*(a-b);
return c;
}
OverLOADING:
Signature changes, but the return type remains the same.
int addition(int a, int b);
changes to
int addition(int a, int b, int prevResult);
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why is oop better than procedural?
What is a class and object?
what is the sylabus for priliminaries?
What is encapsulation process?
Why is polymorphism needed?
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
What is advantage of inheritance?
What do you mean by Encapsulation?
What is abstraction oop?
What is multilevel inheritance?
Can abstract class have normal methods?
Can we define a class within the interface?
How do you achieve polymorphism?
write a program that takes input in digits and display the result in words from 1 to 1000
Why it is called runtime polymorphism?