Inheritance in Java

Course Home | What is Inheritance? | Code Example(s)

We actually covered a lot of Inheritance in the previous Encapsulation lesson. I wanted to specifically add the behaviour of constructors when inheriting other classes. Again the code is too long to put on the page, so please check the link above and read the code and comments.

If you’re taking this course with the intention of working with WebDriver, this behaviour plays a very big part in the creation of PageObjects (PO). So hopefully this makes sense. A common approach with POs is to have a base PO, aka a super PO. That super PO would manage the WebDriver and perhaps some generic waits for the application. Therefore not having to repeat the generic waits on all classes, they can all inherit it from the super PO.

Next Lesson ➔

Richard Bradshaw's photo
Author

Richard Bradshaw

@FriendlyTester

Software Tester, speaker and trainer at Friendly Testing. BossBoss at Ministry of Testing. Whiteboard Testing creator. Striving to improve the testing craft.

Comments