cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
static variable
static variable
Dec 6, 2013 at 6:47pm UTC
Ajaycpp
(40)
Why we need to assign memory explicitly for static variables?
like int Base::m;
can any one please explain?
Last edited on
Dec 6, 2013 at 6:47pm UTC
Dec 6, 2013 at 7:07pm UTC
Zhuge
(4664)
The same reason we need to give a body to a function we have only declared a prototype for. Please think about that and see if you can come up with some specific reasoning yourself. ;)
Dec 6, 2013 at 7:23pm UTC
Ajaycpp
(40)
but here static int m; is not a functon so how can we declare like that?
Dec 6, 2013 at 7:26pm UTC
Zhuge
(4664)
static
int
m;
is basically a prototype for the variable, saying that the name exists but nothing more than that.
Topic archived. No new replies allowed.