Thursday, February 05, 2009

Constructor

"Constructors in C++ are special member functions of a class. They have the same name as the Class Name. There can be any number of overloaded constructors inside a class, provided they have a different set of parameters. There are some important qualities for a constructor to be noted.
  • Constructors have the same name as the class.
  • Constructors do not return any values
  • Constructors are invoked first when a class is initialized. Any initializations for the class members, memory allocations are done at the constructor.
In the example class given below in this C++ tutorial has the constructor Example_Class(), with the same name as the class." to find out more...
Passage from http://www.codersource.net/cpp_tutorial_class.html

No comments:

Related Posts Plugin for WordPress, Blogger...