Skip to content

Instantly share code, notes, and snippets.

@ncaq
Created November 1, 2013 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncaq/7262765 to your computer and use it in GitHub Desktop.
Save ncaq/7262765 to your computer and use it in GitHub Desktop.
このコードはエラーとなる. ならば,コンストラクタは,mutable版とimmutable版の2つを定義するしか,mutableとimmutableに対応する方法はない? 対応できるのに,そういうことをするのはスマートじゃないと思うのですが
class A
{
this()const
{
a_ = 0;
}
private
{
int a_;
}
}
void main()
{
immutable a = new immutable(A)();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment