1Overriding means same method name and same parameter,
2occur in different class that has inheritance relationship.
3we use method overriding to implement specific functionality to the method.
4
5Example: get method
6WebDriver driver = new ChromeDriver();
7driver.get("URL") ==> opens the url from chrome
8
9WebDriver driver = new FireFoxDriver();
10driver.get("URL") ==> opens the url from Firefox
11
12we can only override instance methods and method override
13takes place in sub class.
14instance method that we are going to override cannot be private and final
1Overriding means same method name and same parameter,
2occur in different class that has
3inheritance relationship.
4we use method overriding to implement
5specific functionality to the method.
6
7Examples are get and navigate methods
8of different drivers in Selenium .
9
10Example: get method
11WebDriver driver = new ChromeDriver();
12driver.get("URL") ==> opens the url from chrome
13
14WebDriver driver = new FireFoxDriver();
15driver.get("URL") ==> opens the url from Firefox
16
17we can only override instance methods and method override
18takes place in sub class.
19instance method that we are going to override cannot be private and final
20Example: get method
21WebDriver driver = new ChromeDriver();
22driver.get("URL") ==> opens the url from chrome
23
24WebDriver driver = new FireFoxDriver();
25driver.get("URL") ==> opens the url from Firefox
26
27we can only override instance methods and method override
28takes place in sub class.
29instance method that we are going to
30override cannot be private and final
1Method Overloading
2Method overloading is providing two separate methods in a class
3with the same name but different arguments, while the method return type
4may or may not be different, which allows us to reuse the same method name.
51) Method Overloading occurs with in the same
6class
72) Since it involves with only one class inheritance
8is not involved.
93)In overloading return type need not be the same
104) Parameters must be different when we do
11overloading
125) Static polymorphism can be acheived using
13method overloading
146) In overloading one method can’t hide the
15another
1using method-override in your index.js
21. npm install method-override --save
32. var methodOverride = require("method-override");
43. app.use(methodOverride("_method"));
5//'_method' is what methodOverride will look for
6method override in your UPDATE route:
7* <form action = "/campgrounds/<%=campground._id%>/edit?_method=PUT"
8 method = "POST">
9and EDIT routes:
10