Constructor Chaining

Constructor Chaining


  • In object-oriented programming, constructor chaining is the technique of creating an instance of a class with multiple constructors, then using one constructor to call another. The primary use of constructor chaining is to make a program simpler, with fewer repeated lines of code.

    How does it work?

  • In a language like Java, a class can be thought of as a template for structured data, in which all characteristics and actions defined generally. An instance of the class is a specific data structure with unique values in this defined structure.

  • Normally, a class has a special method that shares the exact name as the class itself. This method, called a constructor, will be executed automatically when a new instance of the class is created. Using ad hoc polymorphism, multiple constructor methods can share the same name and call each other, giving the programmer more options as to how an instance might be created.


    What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

    Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

    Cabin Crew Jobs
    & Career Advice
    » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

    Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes »Scholarships in UK » Scholarships in USA Scholarships in UK » Scholarships in USA Scholarships in UK » Scholarships in USA Scholarships in UK » Scholarships in USA Scholarships in UK »
    Success Quotes »Scholarships in UK »

  • Click here to post comments

    Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.