C++ allows us to declare variables or functions as static members by using the keyword static. Static Data Syntax for declaring a static variable is as follows: static data-type variable-name; Static data members will have the following properties: Only one copy of static data element will be created irrespective of the no. of objects created. All objects share the same copy of the static data element. All static data members are initialized to 0 when the first object for a class is created. Static data members are only visible within the class. But their lifetime is throughout the program.
The post what is the static data in C++ programming appeared first on Coding Security.
what is the static data in C++ programming
read more
Tidak ada komentar:
Posting Komentar