Classes and Objects 2/C++/Important Points

  1. When a member function is called by another member function of the same class, it is calledas nesting of member functions.

  2. The scope resolution operator (::), when used with the class name depicts that the members belong to that class as in class name :: function_name and only used with the variable name as in :: s variable -name, depicts the global variable.(the one with file scope).

  3. When an instance of a class comes into scope, a special function called the constructor gets executed.

  4. The constructor function allocates memory and initializes the class object.

  5. When an instance of a class comes into scope, a special function called the constructor gets executed.

  6. When a class object goes out of scope, a special function called the destructor gets executed.

  7. The constructor function name and the destructor have the same name as the classtag.

  8. A constructor without parameters is called as default constructor.

  9. A constructor with default argument is equivalent to a default constructor
  10. Both the constructors and destructor return nothing. They are not associated with any data type.

  11. Objects can be initialized dynamically.

Leave a comment

Design a site like this with WordPress.com
Get started