Difference between revisions of "Advanced-C++/C2/Function-Overloading-And-Overriding/English-timed"
From Script | Spoken-Tutorial
(Created page with ' {| border=1 | '''Time''' | '''Narration''' |- |00:01 | Welcome to the spoken tutorial on '''function Overloading''' in '''C++.''' |- |00:09 | In this tutorial, we will learn,…') |
|||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
{| border=1 | {| border=1 | ||
| '''Time''' | | '''Time''' | ||
Line 7: | Line 5: | ||
|- | |- | ||
|00:01 | |00:01 | ||
− | | Welcome to the spoken tutorial on ''' | + | | Welcome to the '''spoken tutorial''' on '''Function Overloading and Overriding''' in '''C++.''' |
|- | |- | ||
|00:09 | |00:09 | ||
− | | In this tutorial, we will learn | + | | In this tutorial, we will learn: |
|- | |- | ||
|00:11 | |00:11 | ||
− | |'''Function Overloading | + | |'''Function Overloading''' '''Function Overriding.''' |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
Line 27: | Line 21: | ||
|- | |- | ||
|00:18 | |00:18 | ||
− | | To record this tutorial, I am using | + | | To record this tutorial, I am using: |
|- | |- | ||
|00:21 | |00:21 | ||
− | |'''Ubuntu OS '''version 11.10 | + | |'''Ubuntu OS '''version '''11.10''' |
|- | |- | ||
|00:26 | |00:26 | ||
− | |'''g++ compiler ''' | + | |'''g++ compiler '''version '''4.6.1''' |
|- | |- | ||
|00:30 | |00:30 | ||
− | | | + | |Let us start with an introduction to '''function overloading.''' |
|- | |- | ||
Line 51: | Line 45: | ||
|- | |- | ||
|00:47 | |00:47 | ||
− | |When a '''function''' is called it is selected based on the argument list. | + | |When a '''function''' is called, it is selected based on the '''argument list'''. |
|- | |- | ||
Line 59: | Line 53: | ||
|- | |- | ||
|00:56 | |00:56 | ||
− | | | + | |I have already typed the '''code''' on the '''editor'''. |
|- | |- | ||
|00:59 | |00:59 | ||
− | | | + | |In this program, we will perform addition operations. |
|- | |- | ||
|01:03 | |01:03 | ||
− | |Note that | + | |Note that our file name is '''overload.cpp'''. |
|- | |- | ||
|01:08 | |01:08 | ||
− | |Let me explain the code. | + | |Let me explain the code now. |
|- | |- | ||
|01:10 | |01:10 | ||
− | |This is our '''header file iostream.''' | + | |This is our '''header file''' as '''iostream.''' |
|- | |- | ||
|01:13 | |01:13 | ||
− | |Here we are using the std namespace. | + | |Here we are using the '''std namespace.''' |
|- | |- | ||
|01:17 | |01:17 | ||
− | |Then we have '''add''' function defined as '''int.''' | + | |Then we have '''add()''' function defined as '''int.''' |
|- | |- | ||
|01:21 | |01:21 | ||
− | |In this we have passed three arguments. | + | |In this, we have passed three arguments. |
|- | |- | ||
|01:24 | |01:24 | ||
− | |'''Int a, int b and int c | + | |'''Int a, int b''' and '''int c'''. |
|- | |- | ||
|01:28 | |01:28 | ||
− | | | + | |Then we perform addition of three numbers and we '''return''' the '''value.''' |
|- | |- | ||
|01:33 | |01:33 | ||
− | |Here we overload the function '''add.''' | + | |Here we '''overload''' the function '''add().''' |
|- | |- | ||
Line 107: | Line 101: | ||
|- | |- | ||
|01:38 | |01:38 | ||
− | |We | + | |We have passed two '''arguments''' '''float d''' and '''float e'''. |
|- | |- | ||
Line 115: | Line 109: | ||
|- | |- | ||
|01:48 | |01:48 | ||
− | |This is our '''main''' function. | + | |This is our '''main()''' function. |
|- | |- | ||
|01:50 | |01:50 | ||
− | |In | + | |In function '''main()''', we declare the '''add()''' function with different '''arguments'''. |
|- | |- | ||
Line 127: | Line 121: | ||
|- | |- | ||
|01:58 | |01:58 | ||
− | | | + | |Here we accept integer values from the user. |
|- | |- | ||
|02:03 | |02:03 | ||
− | |Then we call the function '''add '''with three''' ''' | + | |Then we call the function '''add() '''with three ''' arguments''' |
|- | |- | ||
|02:07 | |02:07 | ||
− | | | + | |and store the result in variable''' sum.''' |
|- | |- | ||
|02:09 | |02:09 | ||
− | |Here we print the result. | + | |Here we '''print''' the result. |
|- | |- | ||
|02:12 | |02:12 | ||
− | |Now here we accept floating point numbers from the user. | + | |Now, here we accept '''floating point numbers''' from the user. |
|- | |- | ||
|02:17 | |02:17 | ||
− | |Then we call the add function with two arguments. | + | |Then we call the '''add()''' function with two arguments. |
|- | |- | ||
Line 155: | Line 149: | ||
|- | |- | ||
|02:23 | |02:23 | ||
− | | | + | | This is our '''return''' statement. |
|- | |- | ||
|02:26 | |02:26 | ||
− | |Now let us execute the program | + | |Now, let us '''execute''' the program. |
|- | |- | ||
|02:29 | |02:29 | ||
− | |Open the terminal by pressing '''Ctrl, Alt and T '''keys simultaneously on your keyboard. | + | |Open the '''terminal window''' by pressing '''Ctrl, Alt''' and '''T''' keys simultaneously on your keyboard. |
|- | |- | ||
|02:38 | |02:38 | ||
− | |To execute type: '''g++ overload dot cpp space hyphen o | + | |To execute, type: '''g++ space overload dot cpp space hyphen o space over''' |
|- | |- | ||
|02:49 | |02:49 | ||
− | |''' | + | |press '''Enter'''. |
|- | |- | ||
|02:51 | |02:51 | ||
− | |Type '''dot slash | + | |Type: '''dot slash over''' |
|- | |- | ||
|02:53 | |02:53 | ||
− | |''' | + | |press '''Enter'''. |
|- | |- | ||
|02:55 | |02:55 | ||
− | |It is displayed '''Enter three integers''' | + | |It is displayed- '''Enter three integers''' |
|- | |- | ||
|02:58 | |02:58 | ||
− | |I will enter | + | |I will enter '''10''', '''25''' and '''48'''. |
− | + | ||
|- | |- | ||
|03:04 | |03:04 | ||
− | |The output is displayed as: | + | |The '''output''' is displayed as: '''Sum of integers is 83''' |
− | + | ||
|- | |- | ||
|03:09 | |03:09 | ||
− | |Now we see | + | |Now we see- '''Enter two floating point numbers''' |
− | '''Enter two floating point numbers''' | + | |
|- | |- | ||
|03:13 | |03:13 | ||
− | |I will enter as: | + | |I will enter as: '''4.5''' and '''8.9''' |
− | '''4.5''' and '''8.9''' | + | |
|- | |- | ||
|03:17 | |03:17 | ||
− | |''' | + | |press '''Enter'''. |
|- | |- | ||
|03:19 | |03:19 | ||
− | |The output is displayed as: | + | |The '''output''' is displayed as:''' "Sum of floating point numbers is 13.4" '''. |
− | '''Sum of floating point numbers is 13.4''' | + | |
|- | |- | ||
Line 219: | Line 209: | ||
|- | |- | ||
|03:29 | |03:29 | ||
− | |Let us switch back to our slides. | + | |Let us switch back to our '''slides'''. |
|- | |- | ||
|03:31 | |03:31 | ||
− | |Redefining a '''base class''' '''function''' in the derived class. | + | |Redefining a '''base class''' '''function''' in the '''derived class'''. |
|- | |- | ||
|03:36 | |03:36 | ||
− | |The | + | |The '''derived class''' function '''overrides''' the '''base class''' function. |
|- | |- | ||
Line 235: | Line 225: | ||
|- | |- | ||
|03:44 | |03:44 | ||
− | |And the return-type is also same. | + | |And the '''return-type''' is also same. |
|- | |- | ||
|03:47 | |03:47 | ||
− | |Let us see an example | + | |Let us see an example. |
|- | |- | ||
|03:49 | |03:49 | ||
− | | | + | |Here is an example on '''function Overriding'''. |
|- | |- | ||
|03:53 | |03:53 | ||
− | | | + | |Note that our file name is '''override.cpp.''' |
|- | |- | ||
Line 255: | Line 245: | ||
|- | |- | ||
|04:00 | |04:00 | ||
− | |This is our header file. | + | |This is our '''header file''' as '''iostream'''. |
|- | |- | ||
|04:03 | |04:03 | ||
− | |Here we | + | |Here we are using the''' std namespace.''' |
|- | |- | ||
Line 267: | Line 257: | ||
|- | |- | ||
|04:09 | |04:09 | ||
− | |In this we have declared | + | |In this, we have declared '''integer variables''' as as '''protected.''' |
|- | |- | ||
− | |04: | + | |04:14 |
− | |Then we have ''' | + | |Then we have function '''values()''' declared as '''public'''. |
|- | |- | ||
|04:18 | |04:18 | ||
− | |In | + | |In this, we have passed two '''arguments'''- '''int x''' and '''int y'''. |
|- | |- | ||
|04:23 | |04:23 | ||
− | |Then we stored the | + | |Then we stored the values in '''a''' and '''b'''. |
− | + | ||
|- | |- | ||
|04:26 | |04:26 | ||
− | |Here we have '''virtual function''' as '''operations.''' | + | |Here we have '''virtual function''' as '''operations().''' |
|- | |- | ||
|04:30 | |04:30 | ||
− | |In this we add the two numbers and print the sum. | + | |In this, we add the two numbers and print the '''sum.''' |
|- | |- | ||
|04:34 | |04:34 | ||
− | |Here we close the class. | + | |Here we close the '''class'''. |
|- | |- | ||
Line 304: | Line 293: | ||
|- | |- | ||
|04:45 | |04:45 | ||
− | |In this we calculate the difference of two numbers and we print the difference. | + | |In this, we calculate the difference of two numbers and we print the difference. |
|- | |- | ||
Line 316: | Line 305: | ||
|- | |- | ||
|04:57 | |04:57 | ||
− | |In this we calculate the product of two | + | |In this, we calculate the product of two numbers and display the product. |
|- | |- | ||
|05:03 | |05:03 | ||
− | |Then we have '''class Divide ''' | + | |Then we have '''class Divide '''. This also inherits the''' base class arithmetic.''' |
|- | |- | ||
|05:09 | |05:09 | ||
− | |In this we calculate the division of two numbers and | + | |In this, we calculate the division of two numbers and we display the division. |
|- | |- | ||
|05:15 | |05:15 | ||
− | |Note that the return type of the function is same and the arguments passed are also | + | |Note that the '''return-type''' of the function is same and the '''arguments''' passed are also same. |
|- | |- | ||
|05:23 | |05:23 | ||
− | | | + | |This is our '''main()''' function. |
|- | |- | ||
|05:26 | |05:26 | ||
− | |In this we create an''' object '''of''' class arithmetic as p.''' | + | |In this, we create an''' object '''of ''' class arithmetic''' as '''p.''' |
|- | |- | ||
Line 352: | Line 341: | ||
|- | |- | ||
|05:42 | |05:42 | ||
− | |And''' divd object '''of''' class Divide.''' | + | |And''' divd object ''' of ''' class Divide.''' |
|- | |- | ||
|05:46 | |05:46 | ||
− | |''' | + | |Now here, '''p''' is set to the address of '''arith'''. |
|- | |- | ||
Line 364: | Line 353: | ||
|- | |- | ||
|05:56 | |05:56 | ||
− | |Now we call''' | + | |Now we call the '''function operations().''' |
|- | |- | ||
Line 372: | Line 361: | ||
|- | |- | ||
|06:02 | |06:02 | ||
− | |Here we set '''subt''' to the address of '''arith.''' | + | |Here we set '''subt''' to the '''address''' of '''arith.''' |
|- | |- | ||
Line 380: | Line 369: | ||
|- | |- | ||
|06:11 | |06:11 | ||
− | |Again we call''' function operations.''' | + | |Again we call''' function operations().''' |
|- | |- | ||
Line 388: | Line 377: | ||
|- | |- | ||
|06:18 | |06:18 | ||
− | |Now we set '''mult''' to the address of '''arith.''' | + | |Now, here we set '''mult''' to the '''address''' of '''arith.''' |
|- | |- | ||
|06:22 | |06:22 | ||
− | |And pass | + | |And we pass ''' 6 '''and''' 5''' as arguments. |
|- | |- | ||
|06:26 | |06:26 | ||
− | |We call '''function operations.''' | + | |We call the '''function operations().''' |
|- | |- | ||
|06:29 | |06:29 | ||
− | |This will perform multiplication of two numbers. | + | |This will perform the multiplication of two numbers. |
|- | |- | ||
|06:33 | |06:33 | ||
− | | | + | |At last, we set '''divd''' to the '''address''' of '''arith''' and we pass '''6''' and '''3''' as '''arguments.''' |
|- | |- | ||
|06:41 | |06:41 | ||
− | |Now we''' | + | |Now we call the '''operations()''' function. |
|- | |- | ||
|06:44 | |06:44 | ||
− | |This will perform division of two numbers. | + | |This will perform the division of two numbers. |
|- | |- | ||
|06:48 | |06:48 | ||
− | |And this is our '''return | + | |And this is our '''return''' statement. |
|- | |- | ||
|06:50 | |06:50 | ||
− | |Let us execute the program. Switch back to | + | |Let us '''execute''' the program. Switch back to the '''terminal'''. |
|- | |- | ||
|06:54 | |06:54 | ||
− | |Type: | + | |Type: '''g++ space override dot cpp space hyphen o space over2''' |
− | '''g++ space override dot cpp hyphen o space over2''' | + | |
|- | |- | ||
|07:04 | |07:04 | ||
− | |''' | + | |press '''Enter'''. |
|- | |- | ||
|07:06 | |07:06 | ||
− | |Type: | + | |Type: '''dot slash over2''' |
− | dot slash over2''' | + | |
|- | |- | ||
|07:09 | |07:09 | ||
− | |''' | + | |press '''Enter'''. |
|- | |- | ||
|07:11 | |07:11 | ||
− | |The output is displayed as: | + | |The '''output''' is displayed as: |
|- | |- | ||
Line 458: | Line 445: | ||
|- | |- | ||
|07:25 | |07:25 | ||
− | |Let us switch back to our slides. | + | |Let us switch back to our '''slides'''. |
|- | |- | ||
Line 466: | Line 453: | ||
|- | |- | ||
|07:31 | |07:31 | ||
− | |'''Overloading''' can | + | |'''Overloading''' can occur without '''inheritance'''. |
|- | |- | ||
|07:35 | |07:35 | ||
− | |'''Overriding''' occurs when one class is inherited from another. | + | |'''Overriding''' occurs when one '''class''' is inherited from another. |
|- | |- | ||
|07:41 | |07:41 | ||
− | |In '''overloading''' the arguments and the return-type must differ. | + | |In '''overloading''', the '''arguments''' and the '''return-type''' must differ. |
|- | |- | ||
|07:46 | |07:46 | ||
− | |In '''overriding''' the arguments and the return type must be same. | + | |In '''overriding''', the '''arguments''' and the '''return-type''' must be same. |
|- | |- | ||
|07:51 | |07:51 | ||
− | |In '''overloading''' the function name is same. | + | |In '''overloading''', the function name is same. |
|- | |- | ||
Line 490: | Line 477: | ||
|- | |- | ||
|08:01 | |08:01 | ||
− | |In '''overriding''' the function name is same. | + | |In '''overriding''', the function name is same. |
|- | |- | ||
|08:05 | |08:05 | ||
− | |'''Derived class '''function can perform different operations from the base class. | + | |'''Derived class '''function can perform different operations from the '''base class'''. |
|- | |- | ||
Line 502: | Line 489: | ||
|- | |- | ||
|08:13 | |08:13 | ||
− | |In this tutorial we | + | |In this tutorial, we learnt: |
|- | |- | ||
|08:15 | |08:15 | ||
− | |'''Function overloading | + | | '''Function overloading'''- eg. int add()''' with three different arguments and |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|08:21 | |08:21 | ||
− | |'''float add with two different arguments. | + | |'''float add()''' with two different arguments. |
|- | |- | ||
|08:24 | |08:24 | ||
− | |'''Function Overriding | + | |Then '''Function Overriding'''- |
|- | |- | ||
|08:26 | |08:26 | ||
− | |'''eg. virtual int operations () and int operations ()''' | + | |'''eg. virtual int operations()''' and '''int operations()''' |
|- | |- | ||
|08:31 | |08:31 | ||
− | | | + | | Functions with the same '''argument''' and same '''return-type''' and difference between both.As an assignment. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
Line 543: | Line 517: | ||
|- | |- | ||
|08:46 | |08:46 | ||
− | | | + | |using '''function overloading.''' |
− | + | ||
|- | |- | ||
|08:48 | |08:48 | ||
− | |Watch the video available at the link shown below | + | |Watch the video available at the link shown below. |
|- | |- | ||
|08:52 | |08:52 | ||
− | |It summarizes the Spoken Tutorial project | + | |It summarizes the Spoken-Tutorial project. |
|- | |- | ||
|08:55 | |08:55 | ||
− | |If you do not have good bandwidth, you can download and watch it | + | |If you do not have good bandwidth, you can download and watch it. |
|- | |- | ||
|08:59 | |08:59 | ||
− | |The Spoken Tutorial Project | + | |The Spoken Tutorial Project team: |
|- | |- | ||
|09:02 | |09:02 | ||
− | |Conducts workshops using spoken tutorials | + | |Conducts workshops using spoken tutorials. |
|- | |- | ||
|09:05 | |09:05 | ||
− | |Gives certificates to those who pass an online test | + | |Gives certificates to those who pass an online test. |
|- | |- | ||
|09:09 | |09:09 | ||
− | |For more details, please write to | + | |For more details, please write to: |
|- | |- | ||
Line 580: | Line 553: | ||
|- | |- | ||
|09:16 | |09:16 | ||
− | |Spoken Tutorial Project is a part of the Talk to a Teacher project | + | |Spoken Tutorial Project is a part of the "Talk to a Teacher" project. |
|- | |- | ||
|09:20 | |09:20 | ||
− | |It is supported by the National Mission on Education through ICT, MHRD, Government of India | + | |It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
|- | |- | ||
|09:27 | |09:27 | ||
− | |More information on this | + | |More information on this mission is available at the link shown below. |
|- | |- | ||
| 09:32 | | 09:32 | ||
− | | This is Ashwini Patil from IIT Bombay signing off | + | | This is Ashwini Patil from IIT Bombay, signing off. |
|- | |- |
Latest revision as of 14:49, 23 March 2017
Time | Narration |
00:01 | Welcome to the spoken tutorial on Function Overloading and Overriding in C++. |
00:09 | In this tutorial, we will learn: |
00:11 | Function Overloading Function Overriding. |
00:14 | We will do this with the help of examples. |
00:18 | To record this tutorial, I am using: |
00:21 | Ubuntu OS version 11.10 |
00:26 | g++ compiler version 4.6.1 |
00:30 | Let us start with an introduction to function overloading. |
00:34 | Function Overloading means two or more functions can have same name. |
00:41 | The number of arguments and the data-type of the arguments will be different. |
00:47 | When a function is called, it is selected based on the argument list. |
00:53 | Let us look at an example. |
00:56 | I have already typed the code on the editor. |
00:59 | In this program, we will perform addition operations. |
01:03 | Note that our file name is overload.cpp. |
01:08 | Let me explain the code now. |
01:10 | This is our header file as iostream. |
01:13 | Here we are using the std namespace. |
01:17 | Then we have add() function defined as int. |
01:21 | In this, we have passed three arguments. |
01:24 | Int a, int b and int c. |
01:28 | Then we perform addition of three numbers and we return the value. |
01:33 | Here we overload the function add(). |
01:36 | It is declared as float. |
01:38 | We have passed two arguments float d and float e. |
01:44 | Then we perform the addition operation on two numbers. |
01:48 | This is our main() function. |
01:50 | In function main(), we declare the add() function with different arguments. |
01:56 | Then we declare the variables. |
01:58 | Here we accept integer values from the user. |
02:03 | Then we call the function add() with three arguments |
02:07 | and store the result in variable sum. |
02:09 | Here we print the result. |
02:12 | Now, here we accept floating point numbers from the user. |
02:17 | Then we call the add() function with two arguments. |
02:21 | And here we print the sum. |
02:23 | This is our return statement. |
02:26 | Now, let us execute the program. |
02:29 | Open the terminal window by pressing Ctrl, Alt and T keys simultaneously on your keyboard. |
02:38 | To execute, type: g++ space overload dot cpp space hyphen o space over |
02:49 | press Enter. |
02:51 | Type: dot slash over |
02:53 | press Enter. |
02:55 | It is displayed- Enter three integers |
02:58 | I will enter 10, 25 and 48. |
03:04 | The output is displayed as: Sum of integers is 83 |
03:09 | Now we see- Enter two floating point numbers |
03:13 | I will enter as: 4.5 and 8.9 |
03:17 | press Enter. |
03:19 | The output is displayed as: "Sum of floating point numbers is 13.4" . |
03:25 | Now we will see function overriding. |
03:29 | Let us switch back to our slides. |
03:31 | Redefining a base class function in the derived class. |
03:36 | The derived class function overrides the base class function. |
03:40 | But the arguments passed are same. |
03:44 | And the return-type is also same. |
03:47 | Let us see an example. |
03:49 | Here is an example on function Overriding. |
03:53 | Note that our file name is override.cpp. |
03:57 | Let us go through the code. |
04:00 | This is our header file as iostream. |
04:03 | Here we are using the std namespace. |
04:06 | Then we have class arithmetic. |
04:09 | In this, we have declared integer variables as as protected. |
04:14 | Then we have function values() declared as public. |
04:18 | In this, we have passed two arguments- int x and int y. |
04:23 | Then we stored the values in a and b. |
04:26 | Here we have virtual function as operations(). |
04:30 | In this, we add the two numbers and print the sum. |
04:34 | Here we close the class. |
04:37 | Now we have class Subtract as derived class. |
04:41 | This inherits the base class arithmetic. |
04:45 | In this, we calculate the difference of two numbers and we print the difference. |
04:50 | Now we have another derived class as Multiply. |
04:54 | This also inherits base class arithmetic. |
04:57 | In this, we calculate the product of two numbers and display the product. |
05:03 | Then we have class Divide . This also inherits the base class arithmetic. |
05:09 | In this, we calculate the division of two numbers and we display the division. |
05:15 | Note that the return-type of the function is same and the arguments passed are also same. |
05:23 | This is our main() function. |
05:26 | In this, we create an object of class arithmetic as p. |
05:31 | arith is the pointer to the class arithmetic. |
05:35 | Then we have subt object of class Subtract. |
05:39 | mult object of class Multiply. |
05:42 | And divd object of class Divide. |
05:46 | Now here, p is set to the address of arith. |
05:50 | Then we pass arguments as 30 and 12 in function values. |
05:56 | Now we call the function operations(). |
05:59 | This will perform the addition operation. |
06:02 | Here we set subt to the address of arith. |
06:07 | And we pass 42 and 5 as arguments. |
06:11 | Again we call function operations(). |
06:14 | This will perform subtraction of two numbers. |
06:18 | Now, here we set mult to the address of arith. |
06:22 | And we pass 6 and 5 as arguments. |
06:26 | We call the function operations(). |
06:29 | This will perform the multiplication of two numbers. |
06:33 | At last, we set divd to the address of arith and we pass 6 and 3 as arguments. |
06:41 | Now we call the operations() function. |
06:44 | This will perform the division of two numbers. |
06:48 | And this is our return statement. |
06:50 | Let us execute the program. Switch back to the terminal. |
06:54 | Type: g++ space override dot cpp space hyphen o space over2 |
07:04 | press Enter. |
07:06 | Type: dot slash over2 |
07:09 | press Enter. |
07:11 | The output is displayed as: |
07:13 | Addition of two numbers is 42 |
07:16 | Difference of two numbers is 37 |
07:19 | Product of two numbers is 30 and Division of two numbers is 2 |
07:25 | Let us switch back to our slides. |
07:27 | Let us see the difference of overloading and overriding. |
07:31 | Overloading can occur without inheritance. |
07:35 | Overriding occurs when one class is inherited from another. |
07:41 | In overloading, the arguments and the return-type must differ. |
07:46 | In overriding, the arguments and the return-type must be same. |
07:51 | In overloading, the function name is same. |
07:55 | But it behaves differently depending on the arguments passed to them. |
08:01 | In overriding, the function name is same. |
08:05 | Derived class function can perform different operations from the base class. |
08:11 | Let us summarize: |
08:13 | In this tutorial, we learnt: |
08:15 | Function overloading- eg. int add() with three different arguments and |
08:21 | float add() with two different arguments. |
08:24 | Then Function Overriding- |
08:26 | eg. virtual int operations() and int operations() |
08:31 | Functions with the same argument and same return-type and difference between both.As an assignment. |
08:39 | Write a program that will calculate the area of rectangle, square and circle |
08:46 | using function overloading. |
08:48 | Watch the video available at the link shown below. |
08:52 | It summarizes the Spoken-Tutorial project. |
08:55 | If you do not have good bandwidth, you can download and watch it. |
08:59 | The Spoken Tutorial Project team: |
09:02 | Conducts workshops using spoken tutorials. |
09:05 | Gives certificates to those who pass an online test. |
09:09 | For more details, please write to: |
09:12 | contact@spoken-tutorial.org |
09:16 | Spoken Tutorial Project is a part of the "Talk to a Teacher" project. |
09:20 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
09:27 | More information on this mission is available at the link shown below. |
09:32 | This is Ashwini Patil from IIT Bombay, signing off. |
09:36 | Thank You for joining. |