Jump to content

HTML DOM structure in OOPS

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
msarangam

msarangam

    Newbie

  • Members
  • Pip
  • 1 posts
Hi,
Recently I attended a interview, One interesting question which interviewer asked me is designing of HTML tags in OOPS. He wants an example how object oriented modeling is created for HTML page. I have given him solution has HTML tag as parent class for every HTML page. Where Inside HTML tag ,there are some more tags like BODY etc. I explained him that I try to ensure that type of control inside main HTML Class as Properties with in HTML Object( i.e HTML tag is considered as object). I ensured him that control inside HTML tag are considered has properties in HTML object. Again each BoDY tag contains another elements (i.e child elements)where i assumed that control inside BODY tag considered has particular type in BODY by Ensure that all elements under body tag inherits from one or two interfaces. This makes body object to hold property of particular type. Now interviewer raised a concern that body tag contains n number of other controls like Input tag, Divs or spans etc. If i try to go with approach i had explained above like create properties declared in BODY object,then it would become static or remain fixed .i.e If i declare 3 properties in Body object,then i can have only 3 object type properties in Body object . How can we have multiple 'N' different object acts property in Body object irrespective number of controls objects inside BODY tag.

In OOps, How can I have number of objects inside a class. I cant have properties declared in class or use arrays since both of them static. Dynamically depending on number of controls inside body tag, Body class should create those many object within the Body object. how can i have dynamically number items packed inside the BODY classs.

Though above explanation was confusing , but i just want to know if there is HTML page with html tags ,how would we design in OOPS .

~Mahender

#2
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
Ok... :| What do you actually want? To know how a HTML page could be created if HTML was object-oriented? (Why is this in the C# section anyway :|?)
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics