What does it mean by POD type?cv-qualified?
POD, Plain Old Data, is any C++ type that has an equivalent in C.
cv-qualified type is a type that have been qualified either as a const or volatile.
// non cv_qualified
int one;
char *two;
// cv-qualified
const int three;
volatile char * four;
POD type's data members must be public and can be of any the primitive types: bool, numeric types, enumeration types, data-pointer types, pointer-to-function type, also arrays of any of the previous.
struct A //POD
{
int n;
double y;
};
struct B //non-POD
{
private:
int n;
double y;
};
POD stands for Plain Old Data type. It usually refers to a class that is used to hold data and accessors---nothing else. It is also implied that the function does not have a vtable, which means that there are no polymorphic members of the class. These are popular for lightweight objects where you don't want to pay the price of the polymorphic class overhead.
CV-qualified. C=Const, V=Volatile.
what things in c++ that makes c++ type non equivalent to c – rajKumar
As CMS said, a POD type is a C++ type that has an equivalent in C: so, it has to follow the same rules C uses for:
- initialization
- copying
- layout
- addressing
The C++ type should not have any constructor, must not overload the assignment operator, must not have virtual functions, base classes, destructor and also non-static members that are private or protected.