1Upcasting is casting a subtype to a supertype,
2going up in the inheritance tree.
3It is done implicitly
4 in order to use method available on any
5 interface/class, the object should be of
6 same class or of class implementing the interface.
7 WebDriver driver = new ChromeDriver();
8or
9 TakeScreenShot ts = new ChromeDriver();
1Upcasting is casting a subtype to a supertype,
2going up in the inheritance tree.
3It is done implicitly
4 in order to use method available on any
5 interface/class, the object should be of
6 same class or of class implementing the interface.
7 WebDriver driver = new ChromeDriver();
8or
9 TakeScreenShot ts = new ChromeDriver();
10
11Downcasting is casting to a subtype,
12going down in the inheritance tree.
13It is done to access sub class features.
14It has to be done manually
15
16(TakeScreenShot)driver).takeScreenShot();
17
18