9.2 Math Lab Review

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
4 hours 19 minutes
Difficulty
Beginner
Video Transcription
00:00
hi and welcome back to the course. I hope you guys are doing well. And in this video lecture or lab review, I should say we will be going over a previous lab we did in module four and module for was about methods. And this lab was called math.
00:15
And by reviewing this lab and everything that we coated up in this lab, we will have a better understanding of static polymorphism or also known as compiled time polymorphism, which I mentioned in the previous video which was there to give you an idea of what Polymorphism is and
00:34
just give you a basic understanding of it.
00:36
So at this point, I'd like you to go ahead, switch over to until the J and open up this math lab that we did
00:43
and let's go ahead and review it.
00:45
So what did we do in this lab? We basically made two methods.
00:51
Um, and the first method that we made was called calculate. And in this method, we had two integers that were being multiplied to each other, and we are we were returning of the result.
01:04
Now I remember that we did the slap to demonstrate or to go over implementing the idea of method overloading. And so as a result of that, we created a second method with the same name but with a different method signature. And if you remember, a method signature consists of the name,
01:23
the type and the order
01:26
of the parameters. So all like, this entire first line over here is what the method signature is. And one thing that we said is that by changing the return type of a method that does not count is overloading. But we, uh, still change the return time because we did want to use a different return type. But the point here is that
01:46
we performed method overloading in this lab.
01:49
And
01:51
after we made our second method, we can see here that we will we were adding three doubles.
01:57
And then we tested that by creating a mean method and insider main method, we had a system that outlawed print line to print the result of the first method. And then we had another print statement to print the result of the second method which was overloaded from the first method.
02:15
Now
02:17
does overloading that we performed. That is exactly what we mean by compile time polymorphism or static polymorphism when we were calling this calculate method over here or when we were calling this calculate method over here the way the program or the way
02:37
this the way Intelligent E
02:38
knew which method epic was through its method signature over here and over here. So if we start with the first method, we can see that, uh, this calculate method this version of the calculate method is taking in two integers
02:53
and therefore it would match up with this calculate method over here. So let me just invent that yet. So this calculate method over here and then if we go to this print statement that calculate method being used here is
03:09
this one over here? So that is how it decides which method to use when we invoke or call that method. And that is what we mean by static polymorphism or compile time polymorphism.
03:25
Now I know this all videos was quick and short, but that is essentially what static polymorphism is and why and how it makes the's decision decisions at compile time.
03:40
Now to summarize in this ah lab review our video lecture, we went over static slash compile time polymorphism by reviewing the math lab we did in module for
03:52
and coming up. Next, we will be reviewing our bank account lab that we previously did. And that will be to discuss runtime polymorphism or also known as dynamic Polymorphism.
04:06
Okay, so as always thank you very much for watching this video lecture. And I hope you guys were able to understand a bit more about compile time slash static polymorphism. And if you have any questions at all, feel free to connect with me through Ah, Lincoln and I would be more than happy to answer any of your questions.
04:25
Thank you very much for watching and look forward to seeing you
04:27
in the next video lecture.
Up Next