POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 14:22:52 EDT (-0400)
  Re: Object Oriented POV code  
From: Christopher James Huff
Date: 22 Feb 2004 17:15:24
Message: <cjameshuff-24EA8C.17160622022004@news.povray.org>
In article <4038f726@news.povray.org>, Darren New <dne### [at] sanrrcom> 
wrote:

> Warp wrote:
> > Int foo = container.size(); // <- gets a *reference*
> > foo -= 100; // Ooops! The container breaks badly!
> 
> In this case, you'd make the -= operator return a new reference to be 
> assigned to foo.

You make the initial = create a copy. The actual copy operation may be 
done later, in the -= (copy on write), but from the point of view of the 
user of the code, the -= operator should modify the value of the object 
on the left hand side, not create a new one.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.