Tony C.
2009-12-22 02:07:12 UTC
Hi,
I'm a vb programmer trying to convert to C++ and dealing with a
rather steep learning curve.
I want to pass an array of objects to my function. I was having
trouble passing it by value, so to avoid copying issues I am trying
to pass a pointer to it instead .
The object is of type CPlanet
my function declaration is:
void CBiWheel::DrawTransit2NatalAspectLines(CClientDC *pDC, CPoint
ptCenter, CPlanet &PInners[], CPlanet &Outers[]);
the Array of CPlanets belongs to the Class CCalcedChart and is
defined as:
class CCalcedChart
{
public:
CCalcedChart(void);
~CCalcedChart(void);
CChart myChart;
CPlanet myPlanets[11]; //10 planets
double myHouses[13]; // 12 houses
CPlanet myAsteroids[7];
};
//COuterChart and CInnerChart are of type CCalcedChart.
//So my call to the function looks like:
CBiWheel::DrawTransit2NatalAspectLines(&dlgDC,ptCtr,
CInnerChart.myPlanets, COuterChart.myPlanets);
//I'm gettting this output from the compiler:
Error 6 error C2234: 'PInners' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 7 error C2234: 'Outers' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 27 error C2234: 'PInners' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 28 error C2234: 'Outers' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 29 error C2664: 'CBiWheel::DrawTransit2NatalAspectLines'
: cannot convert parameter 3 from 'CPlanet (*)[11]' to 'CPlanet *[]'
c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp 162
AstroCalcVC1
Error 31 error C2234: 'PInners' : arrays of references are
illegal c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp
708 AstroCalcVC1
Error 32 error C2234: 'POuters' : arrays of references are
illegal c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp
708 AstroCalcVC1
Can anybody tell me what I'm doing wrong?
Thanks, Tony C.
I'm a vb programmer trying to convert to C++ and dealing with a
rather steep learning curve.
I want to pass an array of objects to my function. I was having
trouble passing it by value, so to avoid copying issues I am trying
to pass a pointer to it instead .
The object is of type CPlanet
my function declaration is:
void CBiWheel::DrawTransit2NatalAspectLines(CClientDC *pDC, CPoint
ptCenter, CPlanet &PInners[], CPlanet &Outers[]);
the Array of CPlanets belongs to the Class CCalcedChart and is
defined as:
class CCalcedChart
{
public:
CCalcedChart(void);
~CCalcedChart(void);
CChart myChart;
CPlanet myPlanets[11]; //10 planets
double myHouses[13]; // 12 houses
CPlanet myAsteroids[7];
};
//COuterChart and CInnerChart are of type CCalcedChart.
//So my call to the function looks like:
CBiWheel::DrawTransit2NatalAspectLines(&dlgDC,ptCtr,
CInnerChart.myPlanets, COuterChart.myPlanets);
//I'm gettting this output from the compiler:
Error 6 error C2234: 'PInners' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 7 error C2234: 'Outers' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 27 error C2234: 'PInners' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 28 error C2234: 'Outers' : arrays of references are
illegal c:\project_test_area\1\astrocalcvc1\astrocalcvc1\BiWheel.h 41
AstroCalcVC1
Error 29 error C2664: 'CBiWheel::DrawTransit2NatalAspectLines'
: cannot convert parameter 3 from 'CPlanet (*)[11]' to 'CPlanet *[]'
c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp 162
AstroCalcVC1
Error 31 error C2234: 'PInners' : arrays of references are
illegal c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp
708 AstroCalcVC1
Error 32 error C2234: 'POuters' : arrays of references are
illegal c:\PROJECT_TEST_AREA\1\AstroCalcVC1\AstroCalcVC1\BiWheel.cpp
708 AstroCalcVC1
Can anybody tell me what I'm doing wrong?
Thanks, Tony C.