POV-Ray : Newsgroups : povray.off-topic : OO theory? Python. : Re: OO theory? Python. Server Time
28 Jul 2024 22:21:07 EDT (-0400)
  Re: OO theory? Python.  
From: Warp
Date: 13 Oct 2012 16:31:17
Message: <5079cf95@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 13/10/2012 20:38, Warp nous fit lire :
> > Le_Forgeron <jgr### [at] freefr> wrote:
> >>   Vector & operator +(const Vector &v2) const
> >>   {
> >>      return Vector(
> >> this.internal_storage[0]+v2.internal_storage[0],
> >> this.internal_storage[1]+v2.internal_storage[1],
> >> this.internal_storage[2]+v2.internal_storage[2] );
> >>   }
> > 
> > You are returning a reference to a temporary. Kaboom.
> > 
> Yes. I do not know why I did that (nor put a space before the +).

Or use "this." instead of "this->". (Or using "this" in the first place...)

-- 
                                                          - Warp


Post a reply to this message

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