Languages [3i Infotech Placement]: Sample Questions 54 - 55 of 546

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 54


Describe in Detail


What are the corresponding layouts for card in swing?


  • CardLayout are the corresponding layouts for card in swing.
  • The CardLayout class manages the components in such a manner that only one component is visible at a time.
  • Treats each component as a card that why it known as CardLayout.

Constructors of CardLayout class:

cardLayout ()

  • Creates a card layout with zero horizontal and vartical gap.
  • CardLayout (int hgap, int vgap)
  • Creates a card layout with the given horizontal and vertical gap.
The cardLayout ()

Question 55


Describe in Detail


What are virtual functions?


Understanding Virtual Functions
  • A member function excepted to be redefined in derived classes.
  • It is used when a derived class object is referred using a pointer to the base class- virtual function call through base class pointer executes the derived class version of the function.
  • Virtual functions ensure that the correct function is called for an object, regardless of the type of reference used for function call.
  • Mainly used to achieve runtime polymorphism.
  • Functions are declared with a virtual keyword in base class.

Developed by: