reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Pointers to objects - C++ [1/2]

Type:
Pointers to objects - C++
Level: Expert reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia 
Pointers to objects - C++
Date: 2006-Dec-12
Pointers to objects - C++
Visited: 1743 times
Pointers to objects - C++
Rating: Pointers to objects - C++
Pointers to objects - C++
Author: Alex Plumpton
A pointer can point to an object of a class. Consider a class emp, which is defined as shown.

Example
Class emp
{
int code;
float salary;
public:
Void input(int cfloat s)
{
code=c
salary=s;
}
void display(void)
{
cout"EmpIoyee code'' code;
cout"
Employee salary "salary; 
}
};

we can declare a pointer ptr of type class emp

epm *ptr;
Pointer can be made to point to the object at runtime. Thus, they are useful for dynamic memory allocation. The pointer ptr of class emp is made to point to the address of the object objl as shown.

Emp *ptr = &obj1;

Obj1.input(5,2.3); 
Obj1.display();

(*
ptr).Obj1.input(5,2.3); (*ptr).0bj1.display();
reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia - Pointers to objects - C++ [1/2] - reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: pointers to objects  pointers to objects-c++  c++-pointers to objects  c++ pointers to objects  c++ pointers objects  c++ "pointers to objects" tutorial  Parameterized objects inurl:Parameterized objects  array of objects-c++  end of file pointers C++  file pointers-c++  functions and pointers c++ * &  3d max objects crystals  c++ "file pointers" example  desktop objects C++  breaking objects in 3ds max  c++ arrays of objects  tutorials of handlin pointers:c++  manipulation using file pointers  tutorials for breaking objects in 3ds max  file pointers manipulation in C++