I previously mentioned in Basics of Object Oriented Programming that the main body of any class that we write in our program is usually written in a separate file called .cpp file and its declarations in another header file .h file. This is done in order to avoid clustering of the class definition with the execution body of the program. It makes it pretty easy and efficient to put all the classes in separate files in a large program. This is then included later in a main file and its functions are used in the manner we like. Here is the detailed procedure for it.
Up till now we have overloaded assignment operator and then the addition operator. One another operator which we quite frequently use in our program and thus need to redefine for ourselves is the indexing operator ([ ]). Indexing operator in in fact used to dereference a given index of the array. After overloading indexing operator, we can directly dereference the object for our particular index. Let us see how we can efficiently do this.
Hello everyone. The topic we are about to discuss in the bugs removing section today is switch statement. Switch statement though easies up the coding efficiency by reducing the number of if-else statements but if some technical aspects of switch statement are not taken into consideration, fatal coding errors can result. Switch statement fall through in C programming can tend to be really tedious to find and hard to debug.
This article is the first in a series which will be centered around object oriented programming in C++ for beginners. However, the hope is that programmers of a more intermediate to advanced level who are looking to refresh their basic object oriented programming skills. First we start with an introduction to object oriented programming using C++.