20 Nov 2019

  • November 20, 2019
  • Amitraj
C++ Data Types

Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data etc.

Data types in C++ are categorised in three groups:  Built-in, user-defined and Derived.










1.) Primitive Data Types:
  These data types are built-in or predefined data types and can be used directly by the user to declare variables.   example: int, char , float, bool etc. Primitive data types available in C++ are:

-> Integer
-> Character
-> Void
-> Floating Point / float
-> Double Floating Point / Doble
-> Boolean


2.) Derived Data Types: 
  The data-types that are derived from the primitive or built-in datatypes are referred to as Derived Data Types. These can be of four types namely:

-> Array
-> Function
-> Pointer
-> Reference


3.) Abstract or User-Defined Data Types: 
  These data types are defined by user itself. Like, defining a class in C++ or a structure. C++ provides the following user-defined datatypes:

-> Structure
-> Union
-> Class
-> Enumeration
-> Typedef defined DataType


Related Posts:

  • Virtual Destructors in C++ Virtual Destructors in C++ A virtual destructor however, is pretty much feasible in C++. in fact, its use is often promoted in certain situations. One such situation is when we need to make sure that the different dest… Read More
  • Why A Constructor can not be Virtual Why A Constructor can not be Virtual "A constructor can not be virtual". There are some valid reasons that justify this statement. -> First, to create an object the constructor of the object class must be of the same ty… Read More
  • Abstract Class and Pure Virtual Function in C++ Abstract Class and Pure Virtual Function in C++ -> An Abstract class is one that is not used to create objects.An abstract class is designed only to act as a base class. -> Abstract Class is a class which contains at… Read More
  • Types of Polymorphism in C++ (Run time Polymorphism) 2.) Runtime Polymorphism (Dynamic Binding):-  Sometimes linking of function call to function definition is not known until program execution.  then,this type of polymorphism is known as runtime polymorphis… Read More
  • Virtual Function in C++ C++ Virtual Function:- -> When we use the same function name in both the base and derived classes, the function in base class is declared as virtual using the keyword virtual precending its normal declaration. when a fun… Read More

Translate

Popular Posts