Thread
:
OT: Stupid c++ (Roguelike development)
View Single Post
#
52
August 18th, 2006, 06:31 PM
PvK
National Security Advisor
Join Date: Dec 1999
Posts: 8,806
Thanks: 54
Thanked 33 Times in 31 Posts
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
__________________
OMG updated links!
Price of Power mod for
Dominions 3
Deadly Seas mod for
Dominions 3
Proportions mod for
Space Empires IV Gold
PvK Balance Mod for
Space Empires IV Gold
PvK
View Public Profile
Send a private message to PvK
Visit PvK's homepage!
Find all posts by PvK