これがコピーコンストラクターを実装する私のクラスです
public class TestCopyConst
{
public int i=0;
public TestCopyConst(TestCopyConst tcc)
{
this.i=tcc.i;
}
}
メインメソッドで上記のクラスのインスタンスを作成しようとしました
TestCopyConst testCopyConst = new TestCopyConst(?);
パラメータとして何を渡すべきかわかりません。TestCopyConst のインスタンスを渡す必要がある場合は、再び「new」を選択する必要があります。これにより、パラメーターの入力が再度求められます
TestCopyConst testCopyConst = new TestCopyConst(new TestCopyConst(?));
ここに何が欠けていますか?または、コピーコンストラクターの概念自体が何か違うのでしょうか?