Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this


  1. 1. TYPES OF CONSTRUCTORS Reg No. 1820 1. Default Constructor 2. Parameterized Constructor 3. Copy Constructor
  2. 2. Default Constructor 1. Default Constructor is also called as no argument constructor 2. This constructor has no arguments in it.
  3. 3. Parameterized Constructor 1. A constructor that can take arguments are called parameterized constructors. 2. A parameterized constructor is just one that has parameters specified in it. 3. We can pass the arguments to constructor function when object are created.
  4. 4. Copy Constructor 1. Copy Constructor is used to declare and initialize an object from another object. 2. For example the statement: abc c2(c1); would define the object c2 and at the same time initialize it to the value of c1. 3.The process of initializing through a copy constructor is known as copy initialization.
  5. 5. CHARACTERTISTICS OF OOP 1. Encapsulation/Data hiding 2. Inheritance 3. Polymorphism
  6. 6. Encapsulation/Data hiding "Hiding the Unnecessary“ Encapsulation is hiding the unnecessary. For example in the image the professor do not need to know how a student does her assignment. He is more interested in the end product.
  7. 7. Inheritance "Modeling the Similarity"  Similarities often exist in the world. As shown in image above, one could easily see that there are some similarities between the two President of United States, George H.W Bush (41st President) and George W. Bush (43rd President) George W. Bush is a son of George H.W Bush. He inherits biological features from his father, at the same time, has his own unique feature that one could identify him as George W. Bush.  This bring us to the idea of inheritance that models a “is a” relationship between objects.
  8. 8. Polymorphism "Same Function different behavior"  The word “Polymorphism” comes from two Greek words, “many” and “form”.  We can illustrate the idea of polymorphism easily using the scenario where different animals are asked to “speak”. As you can see from the image above, each animal has their own way of “speaking”.  This illustrates the power of polymorphism where different instances can be treated the same way.