Source |
CodingSec |
Identifiant |
154151 |
Date de publication |
2016-10-02 18:00:14 (vue: 2016-10-02 18:00:14) |
Titre |
How to allocate memory for objects and classes |
Texte |
Class is not allocated any memory. This is partially true. The functions in a class are allocated memory which are shared by all the objects of a class. Only the data in a class is allocated memory when an object is created. Every object has its own memory for data (variables). For example consider the following Student class and its functions: 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 class Student { private: string name; string regdno; string branch; int
|
Envoyé |
Oui |
Condensat |
all allocate allocated any appeared are branch; class classes coding consider created data every example first followingâ studentâ class functions functions: has how int its memory name; not object objects only own partially post private: regdno; security shared string student true variables when which |
Tags |
|
Stories |
|
Notes |
|
Move |
|