Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

pointer to class confusion?

Posted on 2013-06-07
2
Medium Priority
?
452 Views
Last Modified: 2013-06-07
Please consider following class:

class SomeTask
{
 
  public:
     SomeTask();
    ~SomeTask();
    void initialize();
     
  private:  
    InterfaceTask *_serviceInterface;
    Protocol * Protocol;
     
    static SomeTask *_instance;  
 
};

Then consider the following:

SomeTask * SomeTask::_instance = NULL;


Please explain "SomeTask::_instance" pointer.  Is private member _instance getting accessed outside the class?  What is this ::  notation mean?
0
Comment
Question by:naseeam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
evilrix earned 2000 total points
ID: 39228964
That's the correct notation to initialise a static data member. There is no other way to do it. The fact is is private makes no difference. Once it's initialised it can only be accessed from class members.
0
 
LVL 1

Author Closing Comment

by:naseeam
ID: 39228984
Very fast and accurate response.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question