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;
请大神帮忙
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;
请大神帮忙
解决方案 »
- 用MFC做定时关机程序,当鼠标键盘无操作时自动关机,应该怎么做?如何得知鼠标键盘何时不再操作呢?
- VC++怎么结束指定进程
- 一个程序调试的问题
- 如何用C或C++或C#求得CPU序列号和硬盘物理序列号(不是硬盘分区序列号)
- 滚动条能够自动滚动吗?(在线等待)
- 多个线程对一个表进行操作要不要进行同步? 如要,那怎么同步? 欢迎讨论!
- 关于CSocket的OnReceive不能被响应问题。
- psusong(在黑夜中寂寞成长的橡树) ,请进!
- ATL 组件编译连接错误
- VC++上实现OFDM全过程
- 怎么将ProEssentials7插入到VS2010中去
- MFC链接数据库m_pConnection.CreateInstance("ADODB.Connection")
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 &> m_selectPointXIndexs;
for (int i=1 ;i <3;i++)
{
m_selectPointXIndexs.Add(i);
}
The CArray class supports arrays that are similar to C arrays, but can dynamically shrink and grow as necessary.template< class TYPE, class ARG_TYPE > class CArray : public CObjectAt a Glance
Header file: Afxtempl.h
Platforms:
Versions: 1.0 and later
Complete documentation: Visual C++ documentation
See Also
CArray Member Functions, CArray Operators, CObArray
CArray::Add
int Add( ARG_TYPE newElement );
throw( CMemoryException );Return ValueThe index of the added element.ParametersARG_TYPETemplate parameter specifying the type of arguments referencing elements in this array.newElementThe element to be added to this array.ResAdds a new element to the end of an array, growing the array by 1. If SetSize has been used with an nGrowBy value greater than 1, then extra memory may be allocated. However, the upper bound will increase by only 1.Example// example for CArray::Add
CArray<CPoint,CPoint> ptArray;CPoint pt(10,20);
ptArray.Add(pt); // Element 0
ptArray.Add(CPoint(30,40)); // Element 1
CArray Overview | Class Members | Hierarchy ChartSee Also CArray::SetAt, CArray::SetAtGrow, CArray::InsertAt, CArray::operator []
而 CArray 基于 CObject。
CObject 禁止的。
她的 拷贝构造函数是私有的。