Download Complete reference to C++ PDF

TitleComplete reference to C++
File Size328.1 KB
Total Pages97
Table of Contents
                            Introduction
The name "C++"
Operators
Arithmetic Operations on Characters
Testing a Character Type
Arrays
cout<<“Sum of the 5 numbers = ”<<s;
Two-Dimensional Arrays
String & Math Functions
User-defined Functions
Storage Class for Variables
Pointers and Arrays
SESSION-14
Classes and Objects
Constructors : They have same name like class. they don't have return type. they  are invoked through object. they are used to initialize private variable.
Destructors
Inheritance
	Types of Inheritance
	Construction
	Destruction
	Multiple Inheritance
Operator Overloading
Friends
                        
Document Text Contents
Page 1

http://www.research.att.com/~bs/bs_faq.html#difference
http://system/
http://system/
http://unix/
http://ritchie/
http://ritchie/
http://language/
http://language/
http://programming/
http://programming/
http://programming/
http://www.research.att.com/~bs/bs_faq.html#generic
http://www.research.att.com/~bs/bs_faq.html#generic
http://www.research.att.com/~bs/bs_faq.html#oop
http://www.research.att.com/~bs/bs_faq.html#oop
http://www.research.att.com/~bs/bs_faq.html#oop
http://www.research.att.com/~bs/bs_faq.html#oop
http://www.research.att.com/~bs/bs_faq.html#class
http://www.research.att.com/~bs/bs_faq.html#class
http://www.research.att.com/~bs/bs_faq.html#difference
http://www.research.att.com/~bs/bs_faq.html#difference

Page 2

http://abcl/c+
http://abcl/c+
http://evolution/
http://convention/
http://convention/
http://variable/
http://operator/
http://superstructure/
http://science/
http://science/
http://research/
http://mascitti/
http://mascitti/
http://rtti/
http://programming/
http://programming/
http://programming/
http://programming/
http://programming/
http://programming/
http://abstraction/
http://abstraction/
http://programming/
http://programming/
http://language/
http://language/
http://language/
http://language/
http://language/
http://language/
http://system/
http://system/
http://low-level/
http://low-level/
http://low-level/
http://language/
http://language/
http://language/
http://language/
http://language/
http://software/
http://software/
http://software/

Page 48

-------------------------------c++------------------------------------

{
static int x =0;
x++;
cout<<“\n x = ”<<x;

}
void main()
{

int i;
for (i=1;i<=5;i++)

stat();
}

Note: A static variable is initialized only once and the subsequent function calls can access the value of the
previous execution.
If the declaration static is removed, x will be initialized 5 times.

SESSION-13

new concepts in c++-oops

Pointers and Arrays

One of the most common problems in programming in C (and sometimes C++) is the
understanding of pointers and arrays. In C (C++) both are highly related with some small
but essential differences. You declare a pointer by putting an asterisk between the data
type and the name of the variable or function:

char *strp; /* strp is `pointer to char' */

You access the content of a pointer by dereferencing it using again the asterisk:

*strp = 'a'; /* A single character */

As in other languages, you must provide some space for the value to which the pointer
points. A pointer to characters can be used to point to a sequence of characters: the string.

Strings in C are terminated by a special character NUL (0 or as char ' '). Thus, you can
have strings of any length. Strings are enclosed in double quotes:

strp = "hello";

In this case, the compiler automatically adds the terminating NUL character. Now, strp
points to a sequence of 6 characters. The first character is `h', the second `e' and so forth.
We can access these characters by an index in strp:

strp[0] /* h */
strp[1] /* e */
strp[2] /* l */
strp[3] /* l */

Similer Documents