How it is useful to create a static variable in a non static member function? The compiler allows that, and i wonder in what situations it is useful to create static variables in the function bodies as they are going to be disposed at the end of the function call.
serkan sendur 821 Postaholic Banned Featured Poster
Recommended Answers
Jump to PostWhy do you say static variables will be disposed of at the end of the function call?
Jump to PostI'm guessing it would just act like a static variable. I wouldn't make use of it at all -- put any static constants you have in your class definition and don't use static variables.
All 8 Replies
Rashakil Fol 978 Super Senior Demiposter Team Colleague
serkan sendur 821 Postaholic Banned Featured Poster
Rashakil Fol 978 Super Senior Demiposter Team Colleague
Rashakil Fol 978 Super Senior Demiposter Team Colleague
StuXYZ 731 Practically a Master Poster
Rashakil Fol 978 Super Senior Demiposter Team Colleague
StuXYZ 731 Practically a Master Poster
Rashakil Fol 978 Super Senior Demiposter Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.