C
Chris
Hi,
if have a __gc class with a datamember of type : a pointer to a DateTime,
but I get a compiler error :
__gc class Employee
{
public:
DateTime * m_hiringDate; ==> error : cannot declare interior __gc
pointer or
reference as a member of 'class'
Employee(DateTime * hiringDate) {
m_hiringDate = hiringDate;
}
};
so, I declare the pointer and Ctor a follows :
DateTime __nogc * m_hiringDate; ==> OK
Employee(DateTime __nogc * hiringDate) {
m_hiringDate = hiringDate;
}
but then do I get an error when allocating a new Employee
Employee *emp = new Employee(new DateTime(2001,1,1));
==> error : cannot dynamically allocate a value type object with managed
members
on C++ (nogc) heap
How can I make it work ?
What is the proper way do deal with this situation ?
thnx
Chris
if have a __gc class with a datamember of type : a pointer to a DateTime,
but I get a compiler error :
__gc class Employee
{
public:
DateTime * m_hiringDate; ==> error : cannot declare interior __gc
pointer or
reference as a member of 'class'
Employee(DateTime * hiringDate) {
m_hiringDate = hiringDate;
}
};
so, I declare the pointer and Ctor a follows :
DateTime __nogc * m_hiringDate; ==> OK
Employee(DateTime __nogc * hiringDate) {
m_hiringDate = hiringDate;
}
but then do I get an error when allocating a new Employee
Employee *emp = new Employee(new DateTime(2001,1,1));
==> error : cannot dynamically allocate a value type object with managed
members
on C++ (nogc) heap
How can I make it work ?
What is the proper way do deal with this situation ?
thnx
Chris