I came across the following code structure in C++:  uint32_t AClass::Action(....) { ..       status = ::Action(...); .. }   I am not sure what ::Action() means. Which class does it belongs to? NOTE: the argument list of ::Action(...) is different from AClass::Action(...).
30298
In C++, what is the purpose of the scope resolution operator when used without a scope? For instance:  ::foo();
8989
Is anyone aware of a language feature or technique in C++ to prevent a child class from over riding a particular method in the parent class?  class Base { public:     bool someGuaranteedResult() { return true; } };  class Child : public Base { public:     bool someGuaranteedResult() { return false; /* Haha I broke things! */ } };   Even though it's not virtual, this is still allowed (at least in the Metrowerks compiler I'm using), all you get is a compile time warning about hiding non-virtual inherited function X.
24839
class Outer {      class Inner {     public:         Inner() {}         void func() ;     };  private:     static const char* const MYCONST;     int var; };  void Outer::Inner::func() {     var = 1; }  const char* const Outer::MYCONST = "myconst";   This errors out when I compile with class Outer::Inner' has no member named `var'
80212
For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online.  Googling can sometimes feel futile, again especially for the C standards, since they are drowned in the flood of discussions on programming forums.  To get this started, since these are the ones I am searching for right now, where are there good online resources for:   C89 C99 C11 C++98 C++03 C++11 C++14 C++17
14787
I am creating a keyboard hook, wherein KeyboardProc is a static member of a class CWidget.  class CWidget {    static LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam );  };   I want to call the non-static members of CWidget inside the CWidget::KeyboardProc.   What is the best way to do it?   KeyboardProc does not have any 32 bit DWORD where I can pass the 'this' pointer.
99037
I see this from time to time and want to know what it is. I did try google, but its filtering out the characters from the search. I have a few books that don't reference it either.   FWIW, I remember in pascal that is was the assignment operator.   Can anybody point me to the MSDN or similar page?
64639
I have a basic 2D tower defense game in C++.  Each map is a separate class which inherits from GameState. The map delegates the logic and drawing code to each object in the game and sets data such as the map path. In pseudo-code the logic section might look something like this:    update():   for each creep in creeps:     creep.update()   for each tower in towers:     tower.update()   for each missile in missiles:     missile.update()   The objects (creeps, towers and missiles) are stored in vector-of-pointers. The towers must have access to the vector-of-creeps and the vector-of-missiles to create new missiles and identify targets.  The question is: where do I declare the vectors? Should they be members of the Map class, and passed as arguments to the tower.update() function? Or declared globally? Or are there other solutions I'm missing entirely?  When several classes need to access the same data, where should the data be declared?
10040
I am having trouble wrapping my head around these two functions. I understand do_action() but I don't see clearly when  would be useful. Couldn't we pass an array to do_action() as well?
65868
There's a good discussion of Generics and what they really do behind the scenes over at , so we all know that Vector&lt;int[]&gt; is a vector of integer arrays, and HashTable&lt;String, Person&gt; is a table of whose keys are strings and values Persons.  However, what stumps me is the usage of Class&lt;&gt;.  The java class Class is supposed to also take a template name, (or so I'm being told by the yellow underline in eclipse).  I don't understand what I should put in there.  The whole point of the Class object is when you don't fully have the information about an object, for reflection and such.  Why does it make me specify which class the Class object will hold?  I clearly don't know, or I wouldn't be using the Class object, I would use the specific one.
33911
I have been reading through the  and was curious about the  declaration. I personally have never used it, however I am interested in exploring the language.   What is a good example of using friend?    Reading the FAQ a bit longer I like the idea of the &lt;&lt; &gt;&gt; operator overloading and adding as a friend of those classes. However I am not sure how this doesn't break encapsulation. When can these exceptions stay within the strictness that is OOP?
92874
A feature of C++ is the ability to create unnamed (anonymous) namespaces, like so:  namespace {     int cannotAccessOutsideThisFile() { ... } } // namespace   You would think that such a feature would be useless -- since you can't specify the name of the namespace, it's impossible to access anything within it from outside. But these unnamed namespaces are accessible within the file they're created in, as if you had an implicit using-clause to them.  My question is, why or when would this be preferable to using static functions? Or are they essentially two ways of doing the exact same thing?
29529
I am a big fan of letting the compiler do as much work for you as possible.  When writing a simple class the compiler can give you the following for 'free':   A default (empty) constructor A copy constructor A destructor An assignment operator (operator=)   But it cannot seem to give you any comparison operators - such as operator== or operator!=.  For example:  class foo { public:     std::string str_;     int n_; };  foo f1;        // Works foo f2(f1);    // Works foo f3; f3 = f2;       // Works  if (f3 == f2)  // Fails { }  if (f3 != f2)  // Fails { }   Is there a good reason for this?  Why would performing a member-by-member comparison be a problem?  Obviously if the class allocates memory then you'd want to be careful, but for a simple class surely the compiler could do this for you?
104079
Is it possible to chain static methods together using a static class? Say I wanted to do something like this:  $value = TestClass::toValue(5)::add(3)::subtract(2)::add(8)::result();   . . . and obviously I would want $value to be assigned the number 14. Is this possible?  Update: It doesn't work (you can't return "self" - it's not an instance!), but this is where my thoughts have taken me:  class TestClass {     public static $currentValue;      public static function toValue($value) {         self::$currentValue = $value;     }      public static function add($value) {         self::$currentValue = self::$currentValue + $value;         return self;     }      public static function subtract($value) {         self::$currentValue = self::$currentValue - $value;         return self;     }      public static function result() {         return self::$value;     } }   After working that out, I think it would just make more sense to simply work with a class instance rather than trying to chain static function calls (which doesn't look possible, unless the above example could be tweaked somehow).
59637
This seems like a simple question, but I can't find it with the Stack Overflow search or Google. What does a type followed by a _t mean? Such as  int_t anInt;   I see it a lot in C code meant to deal closely with hardware—I can't help but think that they're related.
88627
Possible Duplicate:          I'm learning C++ at the moment, and I'm coming across a lot of null-terminated strings. This has got me thinking, what makes more sense when declaring pointers:  char* string   or  char *string   ? To me, the char* format makes more sense, because the type of "string" is a pointer to a char, rather than a char. However, I generally see the latter format. This applies to references as well, obviously.  Could someone tell me if there is a logical reason for the latter format?
47351
Here is a little test program:   #include &lt;iostream&gt;  class Test { public:     static void DoCrash(){ std::cout&lt;&lt; "TEST IT!"&lt;&lt; std::endl; } };  int main() {     Test k;     k.DoCrash(); // calling a static method like a member method...      std::system("pause");      return 0; }   On VS2008 + SP1 (vc9) it compiles fine: the console just display "TEST IT!".  As far as I know, static member methods shouldn't be called on instanced object.   Am I wrong? Is this code correct from the standard point of view? If it's correct, why is that? I can't find why it would be allowed, or maybe it's to help using "static or not" method in templates?
106335
What does the following mean?  Class.Function(variable := 1 + 1)   What is this operator called, and what does it do?