POV-Ray : Newsgroups : povray.off-topic : This is the sort of brokenness... : Re: This is the sort of brokenness... Server Time
7 Sep 2024 05:09:32 EDT (-0400)
  Re: This is the sort of brokenness...  
From: Warp
Date: 20 Mar 2009 15:36:06
Message: <49c3f025@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> He's saying that putting "private:" before the variables in a class 
> declaration is equivalent to naming private variables with an underscore. In 
> the first case, the compiler warns you if you use a private variable by 
> mistake. In the second case, it's obvious from inspection. If you have
>     x._y
> in your code, you're doing something wrong. :-)

  Btw (not flaming here), what would be the naming convention for nested
classes? Take, for example, this kind of situation, in C++ code:

class OuterClass
{
 public:
    // Public interface here.

 private:
    // Outside code should not access anything from this point forwards.
    // This includes the 'InnerClass' class below.

    class InnerClass
    {
     public:
        // Public interface for OuterClass to use.

     private:
        // Private members of InnerClass. OuterClass should not access.
    };
};

  While it becomes complex, it's possible to have even a *third* nested
class, inside 'InnerClass', with the equivalent access rules.

  (Defining 'InnerClass' outside of 'OuterClass' is not a viable solution
if I really want 'InnerClass' to be strictly inside the scope of
'OuterClass' and nowhere else, because my class design calls for this.)

-- 
                                                          - Warp


Post a reply to this message

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