Minggu, 09 April 2017

How to have pointers within the class in C++

Pointers can be used inside a class for the following reasons: Pointers save memory consumed by objects of a class. Pointers can be used to allocate memory dynamically i.e., at run time.   Following program demonstrates the use of pointers within a class: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #include<iostream> using namespace std; class Student { private: string name; string regdno; int age;

The post How to have pointers within the class in C++ appeared first on Coding Security.


How to have pointers within the class in C++
read more

Tidak ada komentar:

Posting Komentar