View Single Post
  #52  
Old August 18th, 2006, 06:31 PM
PvK's Avatar

PvK PvK is offline
National Security Advisor
 
Join Date: Dec 1999
Posts: 8,806
Thanks: 54
Thanked 33 Times in 31 Posts
PvK is on a distinguished road
Default Re: OT: Stupid c++

C++ is trying to help you to help yourself to write nice code. Why do you want a class member function to have side effects on a global vector defined outside the class?

A nicer way to do it would be to have the constructor take a parameter which tells the object about the global vector (pass it a pointer or reference), store that pointer/reference and use that.

PvK
Reply With Quote