An object which can be modified by some unknown forces (like hardware) other than the program itself can be declared as volatile. Compiler doesn’t apply any optimizations for such volatile objects. Syntax for declaring an volatile object is as follows: volatile ClassName object-name; A member function can be declared as volatile to make the access to member variables to be volatile. A volatile object can access only volatile functions. Syntax for creating a volatile function is as follows: return-type function-name(params-list) volatile; Following program demonstrates both volatile objects and volatile programs: 1 2 3 4 5 6 7 8
The post What are the volatile Objects and Member functions in C++ Programming appeared first on Coding Security.
What are the volatile Objects and Member functions in C++ Programming
read more
Tidak ada komentar:
Posting Komentar