Answer: In order to do any modifications by executing threads,
volatile modifier is used.
volatile is applicable only for a class or struct. We can apply it to the field types such as integral, reference, pointer, enum and generic.
class Color
{
public volatile int clr; // volatile field
Color(int blue)
{
clr = blue;
}
}
Asked In: Spotted While Learning |
Alert Moderator