O
omellet
I'm trying to define a class, A, that has a List<> of interface
instances, IA. IA has a property pointing back to a class A instance,
so I need to forward define IA in order to use it in A.
#include "stdafx.h"
using namespace System;
using namespace System::Collections::Generic;
interface class IA;
ref class A {
public:
List<IA^> coll_;
};
interface class IA {
public:
property IA^ myIA { IA^ get(); }
};
int main(array<System::String ^> ^args)
{
A^ a = gcnew A();
a->coll_ = gcnew List<IA^>();
return 0;
}
compiler output:
fwdTests.cpp
fwdTests.cpp(24) : error C2582: 'operator =' function is unavailable in
'System::Collections::Generic::List<T>'
with
[
T=IA ^
]
Is this a bug, or am I not supposed to be able to do this?
instances, IA. IA has a property pointing back to a class A instance,
so I need to forward define IA in order to use it in A.
#include "stdafx.h"
using namespace System;
using namespace System::Collections::Generic;
interface class IA;
ref class A {
public:
List<IA^> coll_;
};
interface class IA {
public:
property IA^ myIA { IA^ get(); }
};
int main(array<System::String ^> ^args)
{
A^ a = gcnew A();
a->coll_ = gcnew List<IA^>();
return 0;
}
compiler output:
fwdTests.cpp
fwdTests.cpp(24) : error C2582: 'operator =' function is unavailable in
'System::Collections::Generic::List<T>'
with
[
T=IA ^
]
Is this a bug, or am I not supposed to be able to do this?