Should I be using multiple base pages with inheritance or is there a better strategy?
Contrived Example:
Currently I have 20 webpages and they all use my base-page “BasePage”.
ie.) Page1 : BasePage
BasePage provides functions:
- Function1()
- Function2()
- Function3()
Now I decide that 5 of my 20 webpages require the BasePage functions as well as 3 additional functions and a Page_Load():
- Function4()
- Function5()
- Function6()
- Page_Load()
Do I now create another base page like this:
MySecondBasePage : BasePage
and then put Function4(), Function5(), Function6() and Page_Load() in it?
Or is there a better/”proper” strategy to doing this? Should I be using classes?
Yes.
Inheritance is not just about re-use (since we have other ways to do that), but also about managing complexity. This is a nice simple hierarchy that (assuming your real names are a bit better than “SecondPageBase”) will help make it clear what is happening where, and why.