Function Overloading in C++ | CPP Programming Video Tutorial

preview_player
Показать описание
In this c++ / cpp programming video tutorials / lecture for beginners video series, you will learn about overloading functions in c++ programming language.

You will learn what is function overloading, how to overload functions, rules for it in detail with example.

Learn Programming in HINDI at our youtube channel

Catch us on SocialMedia
Рекомендации по теме
Комментарии
Автор

different return types are allowed in fn overloading if we take proper parameter in the fn
#include <iostream>
#include <string>

using namespace std;

int display(int a, int b)
{
return(a+b);
}
double display(double a, double b)
{
return(a+b);
}

int main()
{
cout<<display(2, 3)<<endl;
cout<<display(2.3, 3.3)<<endl;
}
output:
5
5.6

shiva_kumar.poojari
Автор

very much useful to learn program in a easy way. easy to learn and explore. I really admired on your teaching..thanks a lot anil.

nishaphd
Автор

very nice teaching maybe one day you will be as good as a professor at harvard, mit, stanford

xXZorganStudioXx
Автор

A c++program that will initialize two objects Ob(7, 8)Ob2(2, 5)using constructor. The program should then determine the difference of the object using the overloading operator and display the value the resultant object

silviakagwiria
Автор

SIR IN THE 1ST PRGM EXAMPLE THAT U HAVE TAKEN WHEN THE PROGRAM IS EXCECUTED WILL THE CONTROL DIRECTLY PASS FROM DISPLAY() FUNCTION TO OTHER DISPLAY FUNCTION OR WILL IT COME TO MAIN FUNCTION OR HOW WILL THE CONTROL PASS?? WAITING FOR YOUR ANSWER SIR

srinathhc
Автор

#include<iostream>
#include<cstring>
using namespace std;
void display(string first)
{
cout<<first;
}
int display(double x)
{
cout<<(x);
return x;
}
int main()
{

string first="Anup";
string last="Shetty";
display(first);
int y= display(7.5);
cout<<y;
string total=first+" "+last;
}

two functions with different return type is working

harshamuthugannesudhakara
Автор

how to use function overloading using cin>>any value. from users..

dhirajgoswami
Автор

I think the function overloading is NOT unique with respect to return type of function unless they have same parameters. The return type of functions can differ if the arguments are different.

shriharshachebbi
Автор

hey sir can i join with your fb group??

danushamalshan
Автор

im confused cause this same program does not work in turbo c++ software(i know tht for code blocks its different from turbo c++), the string function is completely different in tht case, can anyone help me out how to use string function in turbo c++...

vishwa
Автор

but sir isn't that dynamic poly morphism

aszasq
Автор

For what hell is it needed anyway?
Just to ease source code modification?
Which function to call is determined at compile time.
Wouldn't that be easier to create truncating function that can solely accept all primitive types and do the job?

rospotrebpozor
Автор

very nice teaching maybe one day you will be as good as a professor at harvard, mit, stanford

sushant
join shbcf.ru