int f2() volatile;
volatile S s;
s.f1(); //compilation error, f1 isn't volatile
Whether the object is volatile or not, calling a volatile
member function is always safe, although it might incur performance overhead so
there's no point in declaring every member function as volatile:
s2.f2(); //safe, though possible less efficient
Take advantage of special member promotions, everyday discounts, quick access to saved content, and more! Join Today.