On Sunday, 8 April 2018 at 14:45:34 UTC, kdevel wrote:
On Sunday, 8 April 2018 at 13:00:02 UTC, bauss wrote:

[...]

// a.d
module a;

class Foo
{
        private:
        bool _baz;
        
        public:
        void handleBar(T : Foo)(T[] foos)
        {
                foreach (child; foos)
                {
                        child._baz = true; // Not ok.

replace this line with

   import std.stdio;
   __PRETTY_FUNCTION__.writeln;
   foos.writeln;

This writelns:

   void a.Foo.handleBar!(Bar).handleBar(Bar[] foos)
   [b.Bar, b.Bar]

So foos is actually an array of Bars. And there is no access from a Bar to the private elements of it's baseclass Foo.

Yes, but we're in the module a and private is module level, so it should be accessible from the function regardless of whether it's Bar or not.

Reply via email to