Sunday, June 7, 2015

C++ : Constructor & Distructor

  • Is a member function that is automatically called when an object that class is declare
  • Has same name with class & constructor definition cannot return value
  • If programmer does not provide any constructor, the compiler does default constructor which is very primitive and does nothing.
  • If programmer provide any type of constructor, then programmer must also define a default constructor if it is needed.
  • Used to allocated memory when class object and it’s class member is destroyed.
  • Is a member function with the same name as it’s class prefixed by ~ (tilde)

No comments:

Post a Comment