can Non-static function modify a static variable in c++
Yes, a non-static member function can modify a static data member as long as the data member's visibility allows it.
Yes, see this example for a small sample program.
Conversely a static function cannot modify a regular member variable the way a regular member function can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With