C++

What is Polymorphism in C++

Definition Polymorphism is one of the essential features of object-oriented programming that allows the class object to behave differently at different times. It is divided into two types. Compile time polymorphismRuntime polymorphism Compile Time Polymorphism Compile time polymorphism is also known as early binding or static polymorphism. In this type [...]

2020-08-27T16:26:19+05:30Categories: Programming|Tags: |

What is Inheritance in C++

Definition Inheritance in C++ is the capability of one class to acquire properties and characteristics from another class. The class whose properties are inherited by other class is called the Parent or Base or Super class. The class which inherits properties of other class is called Child or Derived or [...]

2024-04-19T15:02:45+05:30Categories: Programming|Tags: |

What are Functors in C++

Definition A function pointer allows a pointer to a function to be passed as a parameter to another function. Functors (Function Objects) in C++ allows the function call operator() to be overloaded. It allows instantiated object of a class to be called like a function. Advantages of functor compared to [...]

2020-06-06T23:12:49+05:30Categories: Programming|Tags: |

Conversion and Function Call Operator in C++

Definition Conversion Operator is declared like a non-static member function or member function template with no parameters, no explicit return type. They are used to convert between one type and other defined types. It provides a way to implicitly convert an object to its other representation. Function Call Operator is [...]

2020-06-06T14:34:47+05:30Categories: Programming|Tags: |

Constructor and Destructor in C++

Introduction Constructor and Destructor in C++ are special class functions. Constructor initialize values to object members after storage is allocated to the object. Destructor is used to destroy the class object. Constructor Compiler calls constructor when a new object of a class is created, allowing the class to initialize member [...]

2020-06-06T15:48:53+05:30Categories: Programming|Tags: |

Classes and Objects | C++

Introduction Class is a user defined data type, which holds its own data members and member functions, which can be accessed and used by creating instance of that class. It is the building block of Object-Oriented programming. Variables defined inside class definition are called as data members and functions are [...]

2020-02-02T15:00:09+05:30Categories: Programming|Tags: |

Boost.Function | C++

Introduction The Boost.Function library contains a family of class templates that are function object wrappers. It shares features with function pointers in that both define a call interface through which some implementation can be called, and the implementation that is invoked may change throughout the course of the program. Declaring [...]

2020-01-27T20:19:55+05:30Categories: Programming|Tags: , |

Rightmost set bit | C++

To find the rightmost set bit in N, negate N and perform bitwise AND operation with with itself. Then the position of the rightmost set bit in N will be the position of the only set bit in the result. N & -N // Same as N & (~N + [...]

2019-11-17T14:04:41+05:30Categories: Programming|Tags: |

Lambda Expression in C++

Introduction C++11 provides the ability to create anonymous functions, called Lambda Functions. Lambda Expression in C++ allows a function to be defined at the point where it's needed in another expression. It is a function that we can write inline in our code in order to pass in to another [...]

2020-09-04T15:34:36+05:30Categories: Programming|Tags: |

transform() Function in C++

Transform function (std::transform()) is present in the C++ STL. It is defined in algorithm header file. This is used to perform an operation on all elements. It applies the given function to a range and stores the result in another range. The transform function works in two modes i.e. Unary [...]

2020-09-23T15:16:50+05:30Categories: Programming|Tags: |
Go to Top