POV-Ray : Newsgroups : povray.programming : C++ inheritance puzzler : C++ inheritance puzzler Server Time
19 Apr 2024 14:44:41 EDT (-0400)
  C++ inheritance puzzler  
From: clipka
Date: 27 Nov 2010 09:01:15
Message: <4cf10f2b$1@news.povray.org>
Hacking happily along at the POV-Ray code, I stumbled across this MS 
Visual Studio 2005 C++ anomaly:

   class A
   {
       protected:
           void a() {}
   };

   class B : public A
   {
       protected:
           void b(A* other)
           {
               this->a();  // (1)
               other->a(); // (2)
           }
   };

While (1) compiles fine, (2) raises an error C2248, "'A::a' : cannot 
access protected member declared in class 'A'"

What the F*** am I doing wrong here?


Post a reply to this message

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