Home » Learn C++

Pointers and Arrays

Pointers and Arrays
Pointers and Arrays:   There is a close relationship between pointers and arrays. In advanced programming, arrays are accessed using pointers. An array consists of consecutive locations in the computer memory. To access an array, the memory location of the first element of the array is accessed using the pointer variable. The pointer is then incremented to access other elements of the array. The pointer... 

Pointer Variable

Pointer Variable
Pointer Variables   The variable that is used to hold the memory address of another variable is called a pointer variable or simply a pointer.   The data type of the variable (whose address a pointer is to hold) and the pointer variable must be the same. A pointer variable is declared by placing an asterisk (*) after data type or before the variable name in the data type statement.   For example,... 

Pointers in C++

Pointers in C++
Pointers:             Pointers are the most powerful feature of C & C++. These are used to create and manipulate data structures such as linked lists, queues, stacks, trees etc. The virtual functions also require the use of pointers. These are used in advanced programming techniques. To understand the use of pointers, the knowledge of memory locations, memory addresses and storage of... 

Friend Function

Friend Function
Friend Function: A friend function can access all members of a class in which it is declared. It can also access private and protected members of all other classes even though it is not a member function of those classes. It is a non-member function. It is normally used when a function has to access private data of other classes. A friend function is defined in a class. It is defined by using the keyword... 

Destructors in C++

Destructors in C++
Destructors in C++:             When an object is destroyed a special member function of that class is executed automatically. This member function is called the destructor function or destructor. The destructor function has the same name as the name of a class but a tilde sign (~) is written before its name. It is executed automatically when an object comes to the end of its life. Like... 

Constructors in C++

Constructors in C++
Constructors in C++:             A constructor is a member function of a class that is called and executed automatically when an object of that class is created. The name of the constructor function is the same as the name of the class itself. A constructor function may have arguments but it cannot return any value.   Program:   # include <iostream.h> class test { public: test... 

Declaring Objects and Calling Member Functions

Declaring Objects and Calling Member Functions
Declaring Objects of a Class:             The objects of a class are declared in the similar way as the variables of any data or structure type are declared. When a class is defined, no space is reserved for it in the memory. It only provides information how its object will look like. When an object of a class is declared, a memory space is reserved for that object.   The syntax to create... 

Objects in C++

Objects in C++
Objects in C++:             A data type is used to declare a variable. A variable of a data type is also known as the instance or case of that data type. Each variable has a unique name but each variable follows the rules of its data type. When a variable of a data type is declared, some space is reserved for it in the memory.   A class is also like a data type. It is therefore used... 

Member Access Specifiers

Member Access Specifiers
Member Access Specifiers:             The commands that determine whether a member of a class can be accessed from outside the class or not are called member access specifiers.             Normally two types of member access specifiers arc used. These are: Private: Public:   Private Specifier:             The members of a class that can be accessed only from within... 

Members of a Class and Member Functions

Members of a Class and Member Functions
Members of a Class:             A class contains data items and functions. These are called members of the class. The data items are called data members and the functions arc called member functions.   Data Members:             The data items of a class are called data members of the class. For example, a class that has four integer type and two float type data items is declared... 
Get Adobe Flash playerPlugin by wpburn.com wordpress themes
Copyright © 2010 Information Village. All rights reserved.