Ahem,
// initialise members to supplied values
planet::planet(const std::string& p, int w, float n) : plan(p), weight(w), newweight(n){}
Type: Posts; User: Yarbles
Ahem,
// initialise members to supplied values
planet::planet(const std::string& p, int w, float n) : plan(p), weight(w), newweight(n){}
An initialiser list is the preferred method for assigning values to data members in class constructors. For example:
// initialise members to zero / null
planet::planet() : weight(0),...
Blimey O'Reilly, where to start?
planet::planet()
{
weight = myweight;
plan = myplanet;
}
Or better still:
struct person
{
string name;
double weight;
};
Your problem is that although you have declared the static member _elems, you haven't defined it. Add the statement below after your class definition in order to define _elems:
vector<int>...
As far as function pointers are concerned, non-static member functions are accessed via the pointer-to-member operators, whereas a static member function is accessed via a regular pointer. What I was...
Hello 7stud.
Whilst it is true that (class) static variables are created prior to main() being called, surely this is also the case for globals too, which in the example above compiles OK. Also,...
Hello. I'm trying to create a class containing a static data member which is an array of function pointers, but I can't work out the syntax to define and initialise it in the corresponding source...
Thanks. I think I need to experiment a bit with Get/SetFocus() to determine/set where the keyboard focus needs to be.
Probably a simple explanation for this, but it's eluded me so far. If I check for a WM_KEYDOWN message in the window procedure for a completely blank dialog window (ie. no controls, buttons etc.),...