An Introduction to C++

The ACM Student Magazine has a series of courses to teach C++ and java called “Objective Viewpoint”.

The tutorials touch on many aspects of object-orientation. The word object has surfaced in more ways than you can count. There are OOPLs (Object-Oriented Programming Languages) and OODBs (Object-Oriented Databases), OOA (object-oriented […]

C++ Operator Overloading Guidelines

Google Code University website provides tutorials and sample course content so CS students and educators can learn more about current computing technologies and paradigms. In particular, this content is Creative Commons licensed which makes it easy for CS educators to use in their own classes.

Today’s post is about C++ Operator Overloading Guidelines by California […]

Concurrency in C++ – University of Waterloo

Google Code University website provides tutorials and sample course content so CS students and educators can learn more about current computing technologies and paradigms. In particular, this content is Creative Commons licensed which makes it easy for CS educators to use in their own classes.

In the coming posts I will be adding few course links […]

More on Inheritance in C++

In Object Oriented Programming Inheritance is the process by which objects of one class acquire the properties and functionality of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird which is again a part of the class bird.

One reason to […]

Inheritance in C++

In Object Oriented Programming Inheritance is the process by which objects of one class acquire the properties and functionality of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird which is again a part of the class bird.

One reason to […]

C++ Memory Management

By George Belotsky

Published on Linux DevCenter (http://www.linuxdevcenter.com/)
http://www.linuxdevcenter.com/pub/a/linux/2003/05/08/cpp_mm-1.html

Everyone knows that memory management is a difficult and dangerous chore in C++. This series of three articles will show you that the conventional wisdom is not true. When approached correctly, C++’s seemingly archaic memory-management scheme actually provides an opportunity to create spectacular programs ? programs that would not […]

What’s new in C++?

As we begin the study of C++ and object oriented programming, a few commentsare in order to help you get started. Since the field of object oriented programming is probably new to you, you will find that there is a significant amount of new terminology for you to grasp. This is true of any new endeavor and you should
be warned not to be intimidated by all of the new concepts.

We will add a few new topics in each tutorial and you will slowly grasp the entire language.
Comments in C++
Examine the file named CONCOM.CPP for an example of several new things in C++. We will take the CONCOM.CPP new constructs one at a time beginning with the comments.
//CONCOM.CPP
#include /* This is the stream definition file */
void print_it(const int data_value);
main()
{
const int START = 3; // The value of START cannot be changed
const int STOP = 9; // The value of STOP cannot be changed
volatile int CENTER = 6; /* The value of CENTER may be changed
by something external to this
program. */
int index; /* A normal C variable */
for (index = START ; index < STOP ; index++)
print_it(index);
} /* End of program */

void print_it(const int data_value)
{
cout << “The value of the index is ” << data_value << “\n”;
}

// Result of execution
//
// The value of the index is 3
// The value of the index is 4
// The value of the index is 5
// The value of the index is 6
// The value of the index is 7
// The value of the index is 8
A comment begins with the double slash “//”, starts anywhere on a line, and runs to the end of that line where it is automatically terminated. The old method of comment definition used with ANSI- C can also be used with C++ as illustrated in lines 11 through 14, among other places in this program. The new method is the preferred method of comment definition because it is impossible to inadvertently comment out several lines of code. This can be done by forgetting to include the end of comment notation when using the older C method of comment notation. Good programming practice would be to use the new method for all comments and reserve the old method for use in commenting out a section of code during debugging since the two methods can be nested.

It would be well to caution you at this point however, that you should not use comments when the same sense of program definition can be obtained by using meaningful names for variables, constants, and functions. The careful selection of variable and function names can make nearly any code self documenting and you should strive to achieve this in your code.

Encapsulation

Object oriented programming is a new way of approaching the job of programming. Object oriented programming will seem very unnatural to a programmer with a lot of procedural programming experience. This tutorial is the beginning of the definition of object oriented programming, and we will study the topic of encapsulation which is a “divide and […]