i need ur suggestions building oop model for the following case:
- a parent class that represent a WebPage object. this class represent the common shared members between any web page.
- child classes that represent any web page (contact us, about us, ...), where the parent will be the common WebPage object above.
- a startup class that will start the application (say like the main method) and initialize the parent WebPage object.
the startup class will receive arguments, one of the argument will decide which web page(child) to open, other arguments will be used to assign some members in the parent class, to be more clear take a look at the following:
class WebPage //the parent
class AboutUs:WebPage //a web page child
class ContactUs:WebPage //a web page child
WebPage webPage = new WebPage();
webPage.Member1 = argSomeParentMember1
webPage.Member2 = argSomeParentMember2
if(argWebPageToOpen == AboutUs)
else if(argWebPageToOpen == ContactUs)
now the problem in the above code is that the children objects need to be inherited from a parent which has been initialized using outside arguments, where in the above example they didnt, so how to accomplish such design where the first solution flashed in my mind was to create initializer constructor for the child class that accept the arguments and then send it to its parent initializer constructor but i didnt like this solution, so any other ideas?? and plz if u need more clearer description ask me for it cuz am not sure if i have explain my problem well.