1.

Write the rules for writing a constructor function.

Answer»

The rules for writing a constructor functions are

  • They should be declared in the public section.
  • They are invoked automatically when the objects are created.
  • They should not have return types, therefore they cannot return values.
  • They cannot be inherited.
  • They can have default arguments.
  • Cannot refer to addresses.
  • These cannot be static.
  • An object of a class with a constructor cannot be used as a member of a union.


Discussion

No Comment Found