Pure Virtual function-Abstract class

Let us try to understand pure virtual function with the help of an example. #include <iostream>using namespace std;class shape {public:    virtual void calculateArea() {}};class rectangle: public shape {public:    void calculateArea() {        cout << “Rectangle Area calculation” << endl;    }}; In the above example, calculateArea function is overridden in rectangle class. In shape class, definition is empty since shape class does not know what to calculate. Can we say that empty definition of calculateArea function in shape class is not required. Instead, anyone who inherit shape class must redefine or override…

PULL COMMAND TO UPDATE MASTER IN VISUAL STUDIO

In this Blog, we will discuss about “How to update your Master Branch in visual studio”. This can be accomplished using pull command. Before that, we need to understand why we need to update the local Master branch to that of remote Master branch which is git Repo. In a project, multiple people works on the same module and hence we need to update local Master branch so that all changes which are done by developers are updated in your local Master branch . Therefore, when you check-in your changes…

PUSH LOCAL CHANGES IN VISUAL STUDIO TO GIT

In this Blog, we will do some changes in the “test” Branch (which we have shown in my previous blog “Create local branch in VS“) and push those changes to git Repository. Suppose you have done some changes in the code developed using Visual Sudio . Here, I am changing one file(README.txt). Below is the content of the file before and after changes. As soon you save the changes , you will see that changes in “Git Changes” Section. Now, you need to select those files , Right click and…

CREATE LOCAL BRANCH IN VISUAL STUDIO

In this Blog, I am going to explain about “How to create a new branch in VS and how you can push that branch in visual studio to git. In my previous Blog, I have mentioned about Cloning the repository in visual studio. You can see that Blog as well. Below are the steps needs to be followed in order to create New Branch and push that Branch to git .1. Open the VS and Login with your credentials.2. Go to Master branch(Assuming Clone Repo is already Done).Below is the…

Clone git Repository in Visual Studio

In my previous blogs on GIT, I have explained How to clone git repository using GIT GUI. In this , I will explain How to Clone the git repository in VS(Visual Studio). For an ETL developer, Visual studio is also an effective tool for developing SSIS (SQL Server Integration Services) Packages/Projects. In order to clone the git repository in visual studio, you should have an account in VS or if you do not have one, create it. Once you have created the account. Follow the below steps to clone the…

Multiple Inheritance

In multiple inheritance, multiple classes are inherited i.e., when class needs properties of two or more classes and follows “Is-A” relationship as well. Let us take an example to understand the concept of multiple inheritance. #include <iostream>using namespace std;class waterHabitat{public:    waterHabitat() {        cout << “water Habitat c’tor” << endl;    }    ~ waterHabitat() {        cout << “water Habitat d’tor” << endl;    }};class landHabitat{public:    landHabitat() {        cout << “land Habitat c’tor” << endl;    }    ~ landHabitat() {        cout << “land Habitat d’tor” << endl;    }};class amphibian : public waterHabitat, public landHabitat {public:   …

ROLLBACK IN SQL SERVER

Lets discuss about the rollback code or syntax in the SQL-Server. In SQL Server Settings, we generally set auto-commit on. I have worked on many projects where database is SQL-Server and most of them(team mates) were not aware of Rollback syntax in SQL-Server. In oracle, auto-commit is generally set to off. So, we always press on commit button in SQL Developer or any other tool or we use syntax “Commit;” to commit the uncommitted transactions like insert/update. In SQL Server, If you want to explicitly want to commit the transactions…

Overloaded new and delete operator for arrays

Let us try to understand the overloading of new and delete operator for arrays using below example. #include <iostream>using namespace std;void* operator new(size_t sz) {    cout << “Global Memory Allocation: ” << sz << endl;    void* ptr = malloc(sz);    return ptr;}void operator delete(void* ptr) {    cout << “Global memory Deallocation” << endl;    free(ptr);}class Memory {    enum { mem_size = 10 };    int arr[mem_size];public:    Memory() {        cout << “Memory C’tor” << endl;    } ~Memory() {        cout << “Memory D’tor” << endl;    }    void* operator new(size_t sz) {        cout << “Class Memory…

Inheritance

Let us try to understand the basics of inheritance with the help of below example. In this, we have created one class viz. person. This class has some basic information like age and name of a person. Now, let’s say that I want to create a student class. First option is that all the information we keep in the student class like age, name, roll number and standard. Other option is to keep the basic or common information in one class and use this class to form a student class.…

Overload new and delete operator

new operator allocates the memory then calls the constructor. delete operator calls the destructor then delete the memory. As these are operators, so it can be overloaded. But why we need to overload these operators.* In case, there is lot of allocation and deallocation happens from the heap memory, it can affect the performance. So, to overcome this, we overload the new and delete operator.* Also, as part of above scenario, heap memory gets fragmented. As a result, even though there is sufficient memory present in heap, still it is…