9.2 Math Lab Review
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
Already have an account? Sign In »
4 hours 19 minutes
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.
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
just give you a basic understanding of it.
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
and let's go ahead and review it.
So what did we do in this lab? We basically made two methods.
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.
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,
the type and the order
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
we performed method overloading in this lab.
after we made our second method, we can see here that we will we were adding three doubles.
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.
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
this the way Intelligent E
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
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
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.
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.
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
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.
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.
Thank you very much for watching and look forward to seeing you
in the next video lecture.