Constructors - ICSE Class 10 Computer Applications Notes, Diagrams and Solved Questions

What a constructor is and when it runs, default and parameterised constructors, constructor overloading, how a constructor differs from a method, and board-style class programs built around constructors.

In this chapter

  • What a constructor is, its characteristics, and a step-through of new
  • The compiler's default constructor and your own non-parameterised one
  • Parameterised constructors and the this keyword
  • Constructor overloading, with an explorer showing which one runs
  • Constructor vs method, and the void trap
  • Checking values and counting objects in a constructor
  • Copying objects and full "define a class" exam programs