Sponsored Links

Results 1 to 2 of 2

Thread: static member function can be declared explicitly?

  1. #1

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    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. ------- }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 05-31-2012, 01:46 AM
  2. Replies: 1
    Last Post: 05-31-2012, 01:35 AM
  3. Pointers are not accessible for static member funcion
    By saneha in forum C++ Programing
    Replies: 1
    Last Post: 05-02-2011, 05:48 PM
  4. what is Member function in c++ 2011
    By saneha in forum C++ Programing
    Replies: 1
    Last Post: 05-02-2011, 04:46 PM
  5. Replies: 0
    Last Post: 04-24-2011, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft | Jobs