Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
static member function can be declared explicitly?
#1
static member function can be declared explicitly?
Reply
#2
A static data member of a class is just like a global variable for its class. That is, this data member is globally available for all the objects of that class type. The static data members are usually maintained to store values common to the entire class. For instance, a class may have a static data member keeping track of its number of existing objects.

A static data member is different from ordinary data members of a class in various respects:

There is only one copy of a static data member maintained for the entire class which is shared by all the objects of that class.
It is visible only within the class; however, its lifetime (the time for which it remains in the memory) is the entire program.
Two things are needed for making a data member static:

Declaration within the class definition
Definition outside the class definition.
The declaration of a static data member within the class definition is similar to any other variable declaration except that it starts with the keyword static as shown below:

class X { static int count ; // declaration within the class. ------- }

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  why we use inline function if there are simple function available, or what is the spa Vuhelper 0 21,981 05-31-2012, 01:51 AM
Last Post: Vuhelper
  Default Function Argument with example Vuhelper 0 13,336 05-31-2012, 01:47 AM
Last Post: Vuhelper
  What is the difference among calloc function ,malloc function and recalloc function? Vuhelper 0 34,595 05-31-2012, 01:46 AM
Last Post: Vuhelper
  What is Function Overloading in C++ Vuhelper 0 5,405 05-31-2012, 01:45 AM
Last Post: Vuhelper
  offline function in C++ Vuhelper 0 3,630 05-31-2012, 01:42 AM
Last Post: Vuhelper
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 2,996 05-31-2012, 01:40 AM
Last Post: Vuhelper
  how we used the 1-calloc Function 2- malloc Function 3- free () 4- realloc Function i Vuhelper 1 31,143 05-31-2012, 01:35 AM
Last Post: Vuhelper
  What are the function of IO ports in C++ Vuhelper 0 3,603 05-31-2012, 01:27 AM
Last Post: Vuhelper
  Argc(argument count) and argv(argument value) are used in main function Vuhelper 0 2,031 01-04-2012, 10:42 PM
Last Post: Vuhelper
  stack during function call in C++ 2011 Vuhelper 0 2,027 11-05-2011, 05:05 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)