Category Archives: Library

26. Static class member

Static data member are class members that are declared using static keyword A static member has certain special characteristics These are: Only one copy of that member is created for the entire class and is shared by all the objects of that class , no matter how many objects are created. It is initialized to… Read More »

25. Namespace

Consider a situation, when we have two persons with the same name, Zara, in the same class. Whenever we need to differentiate them definitely we would have to use some additional information along with their name, like either the area, if they live in different area or their mother’s or father’s name, etc. Same situation… Read More »

24. What Is Class?

When you define a class, you define a blueprint for a data type. This doesn’t actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object. A class definition starts with the… Read More »

23. What is an object?

In C++, an Object is a real-world entity, for example, chair, car, pen, mobile, laptop, etc. In other words, object is an entity that has state and behavior. Here, state means data, and behavior means functionality. Object is a runtime entity, it is created at runtime. Object is an instance of a class. All the… Read More »

22. Object Oriented Programming

Procedural programming is about writing procedures or functions that perform operations on the data, while object-oriented programming is about creating objects that contain both data and functions. Object-oriented programming has several advantages over procedural programming: OOP is faster and easier to execute OOP provides a clear structure for the programs OOP helps to keep the… Read More »

21. Basic debugging skills

Debugging strategies Although there is no precise procedure for fixing all bugs, there are a number of useful strategies that can reduce the debugging effort. A significant part (if not all) of this process is spent localizing the error, that is, figuring out the cause of its symptoms. Below are several useful strategies to help… Read More »

20. Handling Exceptions

An exception is a problem that arises during the execution of a program. A C++ exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero. Exceptions provide a way to transfer control from one part of a program to another. C++ exception… Read More »

19. Math functions

C++ has many functions that allow you to perform mathematical tasks on numbers. C++ offers some basic math functions and the required header file to use these functions is <math.h. Mathematical calculations can be done in C++ programming language using the mathematical functions which are included in math or cmath library. These mathematical functions are defined to… Read More »

18. Strings

C++ provides following two types of string representations − The C-style character string. The string class type introduced with Standard C++. The C-Style Character String The C-style character string originated within the C language and continues to be supported within C++. This string is actually a one-dimensional array of characters which is terminated by a null character… Read More »

17. Return Array from Functions

C++ does not allow to return of an entire array as an argument to a function. However, you can return a pointer to an array by specifying the array’s name without an index. If you want to return a single-dimension array from a function, you would have to declare a function returning a pointer as… Read More »