- Functions defined in a class are by default inline.
- Memory space for the members of a class is allocated when an object of that class is created, not before that(at declaration of the class).
- Compiler provides a zero argument constructor only when there is no other constructor defined in the class.
- Realloc can be used to reallocate the memory allocated using new operator.
- Size of the pointer does not depend on where it is pointing to, it is always the same.
- Copy constructor and assignment operators are provided by default by the compiler.
- When an object is passed or returned to/from a function by value the copy constructor gets called automatically.
- For a template function to work it is mandatory that its definition should always be present in the same file from where it is called.
- All static data members are initialized to zero.
- For every static data member of a class it should also be defined outside the class to allocate the storage location.
By Gurpreet Singh, Department of Computer Science & Engineering, Amritsar College of Engineering & Technology
Thursday, 14 May 2015
Some facts on C/C++
Labels:
C&Cpp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment