What happens, If calling volatile member function with not volatile object?
#include <iostream>
using namespace std;
class A
{
private:
int x;
public:
void func(int a) volatile
{
x = a;
cout<<x<<endl;
}
};
int main()
{
A a1; // non volatile object
a1.func(10);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire