Can someone explain why i can change Bar's immutable name member please?

        import std.stdio;

        class Foo
        {
                public void change(string name)
                {
                        name = "tess";
                        writeln(name);
                }
        }

        class Bar
        {
                private static immutable string name = "gary";

                public void test()
                {
                        auto foo = new Foo();
                        foo.change(this.name);
                }
        }

        void main(string[] args)
        {
                auto bar = new Bar();
                bar.test();
        }

I thought an error would inform me that the `Foo.change` function is being called with the wrong parameter type.

Reply via email to