Hi, does anyone know if it is possible to define the function body of a
getter and setter in the .cpp file?
I have tried this, but it doesn't work (Error 1 error C2039:
'get_VolumeDataList' : is not a member of 'VolumeInfo'
d:\\VolumeInfo.cpp 7)
VolumeInfo.h
property List<VolumeData ^>^ VolumeDataList
{
List<VolumeData ^>^ get();
void set(List<VolumeData ^>^ volumeDataList);
}
VolumeInfo.cpp
List<VolumeData ^>^ VolumeInfo::get_VolumeDataList()
{
return m_volumeDataList;
}
void VolumeInfo::set_VolumeDataList(List<VolumeData ^>^ volumeDataList)
{
m_volumeDataList = volumeDataList;
}
The reason I want to put it in the .cpp file is because I have some
extra error checking that I want to add in, without padding out the
class definition (.h file).
Thanks,
Jochen Kalmbach [MVP] - 20 Nov 2006 13:03 GMT
Hi Mark!
> Hi, does anyone know if it is possible to define the function body of a
> getter and setter in the .cpp file?
It seems that you need to use a "helper-method" which must be called in
the h-File...
Something like:
property List<VolumeData ^>^ VolumeDataList
{
List<VolumeData ^>^ get() { return Get_VolumeDataList(); }
void set(List<VolumeData ^>^ volumeDataList); {
Set_VolumeDataList(volumeDataList; }
}
VolumeInfo.cpp
List<VolumeData ^>^ VolumeInfo::Get_VolumeDataList()
{
return m_volumeDataList;
}
void VolumeInfo::Set_VolumeDataList(List<VolumeData ^>^ volumeDataList)
{
m_volumeDataList = volumeDataList;
}
adebaene@club-internet.fr - 20 Nov 2006 13:23 GMT
Mark Ingram a ?crit :
> Hi, does anyone know if it is possible to define the function body of a
> getter and setter in the .cpp file?
[quoted text clipped - 12 lines]
>
> VolumeInfo.cpp
List<VolumeData ^>^ VolumeInfo::VolumeDataList::get()
{
//....
}
void VolumeInfo::VolumeDataList::set(List<VolumeData ^>^
volumeDataList)
{
//...
}
Arnaud
MVP - VC
Jochen Kalmbach [MVP] - 20 Nov 2006 13:51 GMT
Hi adebaene!
>> VolumeInfo.cpp
>
[quoted text clipped - 8 lines]
> //...
> }
Upps...
Thanx for the info!
Greetings
Jochen
Mark Ingram - 20 Nov 2006 14:02 GMT
> Mark Ingram a écrit :
>
[quoted text clipped - 28 lines]
> Arnaud
> MVP - VC
Thank you :)