We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: of

Object Oriented Approach to Display a sequence of numbers without any For-Loop or Recursion

Suppose we have to display a sequence of numbers like from 10 to 20 i.e. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 Advertisements without using any for-loop and recursion. Solution: Frequently Asked: Object Oriented Approach to Display a sequence of numbers without any For-Loop or Recursion We will use two concepts …

Object Oriented Approach to Display a sequence of numbers without any For-Loop or RecursionRead More

Designing Code to Convert the base of a Number to any other base in Number System

In this article we will discuss how to design a Class that represents the Number in a Number System and also provides the facility to convert the Base associated with that Number i.e. conversion from any Base to any other base like, octal to hexa or hexa to decimal etc. [showads ad=inside_post] Create a class Number that …

Designing Code to Convert the base of a Number to any other base in Number SystemRead More

Remove all occurences of an element from vector in O(n) complexity

Suppose we have a vector of integers and we want to delete all occurences of a number from it i.e. Let’s say vector contain following numbers 1,2,5,4,5,1,5,7,8,9. Now we want to delete all the occurences of 5 from it, so that vector contents should become – 1 2 4 1 7 8 9 . Also …

Remove all occurences of an element from vector in O(n) complexityRead More

Importance of Constructors while using User Defined Objects with std::vector

For User Defined classes if Copy Constructor and Assignment Operator are public then only one can insert it’s object in std::vector. This is because of two reasons, Advertisements All STL contains always stores the copy of inserted objects not the actual one. So, whenever we insert any element or object in    container then it’s …

Importance of Constructors while using User Defined Objects with std::vectorRead More

Iterating over a range of User Defined objects and calling member function using std::for_each

In this article we will discuss how to iterate over a container of user defined objects and call a member function on each of the iterating element.Suppose you have a vector of Employee class objects and you want to call a member function on each of the element in vector. [showads ad=inside_post] Let’s see how …

Iterating over a range of User Defined objects and calling member function using std::for_eachRead More

Need of Factory Method Design Pattern in Frameworks Explained

Factory Method Design Pattern

In a framework we deal mainly with abstract classes. Application that is going to use our framework provides the derived classes these abstract classes. Let’s understand by an example of Thread pooling Framework, A thread pooling framework provides the facility to execute Tasks in pooled environment by worker threads. It’s doesn’t know what actually the …

Need of Factory Method Design Pattern in Frameworks ExplainedRead More

C++11 Multithreading – Part 6: Need of Event Handling

Multithreaded Application

In this article we will discuss the need of Event Handling in Multi-threading. Sometimes a thread needs to wait for an event to happen like a condition to become true or a task to be completed by another thread. Advertisements For example, Suppose we are building a network based application. This application does following tasks, …

C++11 Multithreading – Part 6: Need of Event HandlingRead More

Designing a Thread Pool Framework Part 1: What’s the need of a Thread Pool

ThreadPool

In this we will discuss what is a Thread pool and why do we need Thread Pools. Many times you encounter a situation where where you need to perform several tasks in parallel to improve the performance of application. These Tasks can be anything like, Advertisements Encrypting a file. Calculating hash of a file. Performing …

Designing a Thread Pool Framework Part 1: What’s the need of a Thread PoolRead More

Difference between delete & []delete and rise of Memory Leaks

In this article we will discuss the difference between delete &  []delete and how mixing new [] with delete can give rise to Memory Leaks. To allocate memory dynamically on heap we use new[] operator i.e. Advertisements class Sample; Sample * ptrArr = new Sample[5]; Here new[] performs following operations internally, In first step, it …

Difference between delete & []delete and rise of Memory LeaksRead More

Cart

Your Cart is Empty

Back To Shop