16,471
社区成员
发帖
与我相关
我的任务
分享
1>d:\program files\microsoft visual studio 2010\vc\atlmfc\include\afxtempl.h(262): error C2248: “CObject::CObject”: 无法访问 private 成员(在“CObject”类中声明)
1> d:\program files\microsoft visual studio 2010\vc\atlmfc\include\afx.h(534) : 参见“CObject::CObject”的声明
1> d:\program files\microsoft visual studio 2010\vc\atlmfc\include\afx.h(509) : 参见“CObject”的声明
1> 此诊断出现在编译器生成的函数“CArray<TYPE,ARG_TYPE>::CArray(const CArray<TYPE,ARG_TYPE> &)”中
1> with
1> [
1> TYPE=int,
1> ARG_TYPE=int &
1> ]
CArray<int,int &> CPlotChartControl::GetXSeletedIndexs(void)
{
double scaleX = m_rectPlot.Width() / (m_xAxis.fMax - m_xAxis.fMin);
double fxL ;
int max=m_curSelectRect.right;
int min=m_curSelectRect.left;
for(int i=0;i<m_nLen;i++)
{
fxL = m_rectPlot.left+(m_pXData[i] - m_xAxis.fMin) *scaleX ;
if(fxL>min&&fxL<max)
m_selectPointXIndexs.Add(i);
}
return m_selectPointXIndexs;
测试了一下,不会出错
CArray<int,int &> m_selectPointXIndexs;
for (int i=1 ;i <3;i++)
{
m_selectPointXIndexs.Add(i);
}
CPoint MaximaPoint;
MaximaPoint.x = static_cast<int>(m_rectPlot.left + (m_pXData[j] - m_xAxis.fMin) * scaleX);
MaximaPoint.y = static_cast<int>(m_rectPlot.bottom - (m_pYData[j] - m_yAxis.fMin) * scaleY);
if(!m_selectPointVIndex.IsEmpty()) //查看m_selectPointVIndex是否有重复的索引号
{
bool bflags = false;
for(int k=0; k<m_selectPointVIndex.GetSize(); k++)
{
if(j == m_selectPointVIndex.GetAt(k))
bflags = true;
}
if(bflags) //有重复序号
;
else //没有重复序号
{
m_selectPoint.Add(MaximaPoint);
m_selectPointVIndex.Add(j);
}
}
else //第一次选取的点
{
m_selectPoint.Add(MaximaPoint); //存极值的点坐标
m_selectPointVIndex.Add(j); //存极值点的索引号
}
Invalidate();
}
别人程序也这样编译没问题CArray<int,int &> ->CArray<int,int>