Programs used for c++training
Variable is a location in computer memory where you can store and retrive value. C++ is strongly typed and statically typed lanaguage. A pointer type is used store address of memory location.
Discuss issues with raw pointers.
Means during conversion , function parameter passing or return is storing appropriate type of data which should not result in loss , incorrect interpretation or memory corruption.
If a constructor also initializes a given data member, the member initializer is overridden.
Order of static variable initializatoin and destruction are undefined.
Static local variables retain there values between entry and exit of their scope.
using IntPtr = int*;
prefer type aliase over typedefs
const_cast used to remove constant ness of object Should only be used in case we don't have control over callee like libraries.
stream buffer get flushed
- When flushed explicitely using endl
- When buffer is full
- stream goes out of scope and destructed
Not all streams are buffered cerr is un buffered
The C++ smart pointer idiom resembles object creation in languages such as C#: you create the object and then let the system take care of deleting it at the correct time. The difference is that no separate garbage collector runs in the background memory is managed through the standard C++ scoping rules so that the runtime environment is faster and more efficient.