Regarding mulix remark: "[what does c++ have to do with linux-il? this question would've probably been better suited to hackers-il, or cpp-are-us-il, or bored-students-dont-wanna-study-answer-questions-all-day-in-email-il]"
1. While Shaul Karl question was not a Linux question--I think that a certain dose of programming questions are fruitful and 'fertilizing' (if I may say so) --even on this list. More or less, aren't we all earn a leaving through programming (even those doing system administration have to do it now and then). In my opinion it's not suitable to be so narrow focused- in the end it's simply not self-beneficial. 2. About Stroustrup book -- this issue (separate allocation of static members of a class) is well documented in other more accesible books: of Schildt or Eckel-the last one is online. 3. I preffer to put the static member allocations on the first lines of the file which contains the .cpp of the class involved- it's more tidy. Edy > On Mon, Apr 01, 2002, mulix wrote about "Re: C++: a constructor can not operate on a >private static map object?": > > > In what follows I fail to operate in the class constructor on a map > > > object that was defined as a private static member of that class. Can > > > any one points to what is being done wrong? > >... > > > > that is, you're referring to an object which doesn't have any storage > > allocated for it. adding this line > > > > map<const string, category*> category::allCategories; > > > > to your main.cc would solve your problem. > > Right - "static" members of a class are like any other global variables: > they must be defined somewhere, not just declared. The difference is > subtle, but important. Just like for a global variable where you can > do > extern int n; > in many files, but you must do in exactly one file > int n; > > Stroustrup has a subsection dedicated to this issue (definition of static > members) in his book, which I recommend you take a look (I don't have the > book handy right now, so you'll have to look in the index yourself). > > -- > Nadav Har'El | Monday, Apr 1 2002, 20 Nisan 5762 > [EMAIL PROTECTED] |----------------------------------------- > Phone: +972-53-245868, ICQ 13349191 |I used to be a lumberjack, but I just > http://nadav.harel.org.il |couldn't hack it, so they gave me the axe. > > ================================================================= > To unsubscribe, send mail to [EMAIL PROTECTED] with > the word "unsubscribe" in the message body, e.g., run the command > echo unsubscribe | mail [EMAIL PROTECTED] ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]