Posts Tagged ‘efficient programming’

Maintaining Classes in Separate Files in C++

Written by Hamza. Posted in C++

header and definition files

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. 

Switch Statement Fall through in C++

Written by Ali. Posted in C++

switch statement

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.