The Volatile Member Function
In C++, one can declare a member function with volatile specifies. This step leads to call safely the volatile object. Calling volatile member function with volatile object is safe. This concept is supported with the following programming example.
8.31 Write a program to call a volatile member function from a volatile object.
Explanation: The volatile member function f() is called from a volatile object c and the value of x is initialized to 10. Its value is increased by one and displayed on the screen.