1 & gt; D: \ \ program files \ Microsoft visual studio 2010 \ \ vc atlmfc \ include \ afxtempl h (262) : error C2248: "CObject: : CObject:" don't have access to private member (in "CObject" class declarations) 1> D: \ \ program files \ Microsoft visual studio 2010 \ \ vc atlmfc \ include \ afx h (534) : look at the statement "the CObject: : CObject" 1> D: \ \ program files \ Microsoft visual studio 2010 \ \ vc atlmfc \ include \ afx h (509) : see "CObject statement "1> The diagnosis in the compiler to generate the function of "CArray 1> With 1> 1> TYPE=int, 1> ARG_TYPE=int & amp; 1> ] Write their own code
CArray 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 { FxL=m_rectPlot. Left + (m_pXData [I] - m_xAxis. FMin) * scaleX; If (fxL> Min& & FxL M_selectPointXIndexs. Add (I); } Return m_selectPointXIndexs; Ask god to help
CodePudding user response:
I type is not int & amp;
CodePudding user response:
reference 1st floor zhao4zhong1 response: I type is not int & amp; ?? Specific how to modify?? CPoint MaximaPoint; MaximaPoint. X=static_cast & lt; Int> (m_rectPlot. Left + (m_pXData [j] - m_xAxis. FMin) * scaleX); MaximaPoint. Y=static_cast & lt; Int> (m_rectPlot. Bottom - (m_pYData [j] - m_yAxis. FMin) * scaleY); if(! M_selectPointVIndex. IsEmpty ())//check if there is a repeated m_selectPointVIndex index number { Bool bflags=false; For (int k=0; K { If (j==m_selectPointVIndex GetAt (k)) Bflags=true; } If (bflags)//a repeat sequence number ; The else//not repeat number { M_selectPoint. Add (MaximaPoint); M_selectPointVIndex. Add (j); } } The else//selected points for the first time { M_selectPoint. Add (MaximaPoint);//save extremum point coordinates M_selectPointVIndex. Add (j);//save extreme value point index number } Invalidate (). } Others program compiled so no problem CodePudding user response:
What's the matter with your m_selectPointXIndexs defined CodePudding user response:
CArray -> CArray CodePudding user response:
reference WUYUAN2011WOAINI reply: 3/f m_selectPointXIndexs how you define the CArray M_selectPointXIndexs;//select frequency index of X This definition of CodePudding user response:
test and will not go wrong CArray M_selectPointXIndexs; For (int I=1; i <3; I++) { M_selectPointXIndexs. Add (I); } CodePudding user response:
refer to 6th floor WUYUAN2011WOAINI response: test and will not go wrong CArray M_selectPointXIndexs; For (int I=1; i <3; I++) { M_selectPointXIndexs. Add (I); } Headache, run before that's true, then write a function, operation have a problem, now the function is cancelled, or useless CodePudding user response:
CArray The CArray class supports arrays that are similar to C arrays, but can dynamically The shrink and grow as necessary. Template At a Glance The Header file: Afxtempl. H Platforms: Versions: 1.0 and later Complete documentation: Visual c + + documentation See Also CArray Member Functions provides to CArray Operators, CObArray CArray: : Add Int the Add (ARG_TYPE newElement); Throw (CMemoryException); The Return Value The index of The added element. The Parameters ARG_TYPE Template parameter specifying the type of the arguments referencing elements in this array. NewElement The element to be added to this array. Few Adds a new element to the end of an array, growing the array by 1. If SetSize has had 2 with an nGrowBy value greater than 1, then extra memory may be allocated, clear that the upper bound will happens by only 1. Example //example for CArray: : Add CArray PtArray; CPoint pt (10, 20); PtArray. Add (pt);//Element 0 PtArray. Add (CPoint (30, 40));//Element 1 CArray the Overview | Class Members | Hierarchy Chart See Also CArray: : SetAt, CArray: : SetAtGrow CArray: : InsertAt CArray: : operator [] CodePudding user response:
His whole into a member variable why return value I would never use it CodePudding user response:
Return to CArray need copy constructor, And CArray CObject based, CObject forbidden, Her copy constructor is private,