Home > Software engineering >  How to call a class member object container value
How to call a class member object container value

Time:01-06

I define a line segment, the code is as follows:
 # pragma once 

#include
using namespace std;
The class line
{
Private:
Cstrings name;//curve name
The float min;//the minimum
Float Max;//Max
Color line_color;//color value
Int line_path;//track
Int line_width;//line width
Public:
Vector The value;//curve values
The line (void);
~ the line (void);
The line (TCHAR * m_name, float m_min, float m_max, Color m_line_color, int m_line_path, int m_line_width);
Void Set_name (cstrings name);//set curve name
Void Set_min (float min);//set the minimum
Void Set_max (float Max);//set the maximum
Void Set_color (Color line_color);//set colors
Void Set_path (int line_path);//set the orbit
Void Set_width (int line_width);//set the line width

Cstrings return_name ();//return curve name
Float return_min ();//return the minimum
Float return_max ();//returns the maximum
Color return_color ();//return color value
Int return_path ();//return orbital value
Int return_width ();//returns the line width values
};
# include "StdAfx. H"
H # include "line."
//# include "afxtempl. H"



Line: line (void)
{
//id=yuwen shuxue of==NULL;
Name=_T (" ");
Min=0;
Max=0;
Line_color=Color (0, 0);
Line_path=0;
Line_width=1;
}


The line: : ~ line (void)
{
//delete [] name;
}
Line: line (TCHAR * m_name, float m_min, float m_max, Color m_line_color, int m_line_path, int m_line_width)
{

This - & gt; Name=m_name;
This - & gt; Min=m_min;
This - & gt; Max=m_max;
This - & gt; Line_color=m_line_color;
This - & gt; Line_path=m_line_path;
This - & gt; Line_width=m_line_width;
}
Void line: : Set_name (cstrings m_name)//set name
{
This - & gt; Name=m_name;
}
Void line: : Set_min (float m_min)//set the minimum
{
This - & gt; Min=m_min;
}
Void line: : Set_max (float m_max)//set the maximum
{
This - & gt; Max=m_max;
}
Void line: : Set_color (Color m_line_color)//set colors
{
This - & gt; Line_color=m_line_color;
}
Void line: : Set_path (int m_line_path)//set the orbit
{
This - & gt; Line_path=m_line_path;
}
Void line: : Set_width (int m_line_width)//set the line width
{
This - & gt; Line_width=m_line_width;
}

Cstrings line: : return_name ()//return curve name
{
Return the name;
}
Float line: : return_min ()//return the minimum
{
Return min;
}
Float line: : return_max ()//return the maximum
{
return max;
}
The Color line: : return_color ()//return Color value
{
Return line_color;
}
Int line: : return_path ()//return orbital value
{
Return line_path;
}
Int line: : return_width ()//return line width value
{
Return line_width;
}


Defines an object in the main program line NCO=line (_T (" near the C/O "), 0.4, 0.6, Color (0, 0), 1, 1);
And then put into the array line arrline [12]={NCO,,,,,,}, I through the NCO value. The push_back (1) enter a value, then through arrline [0]. Value [0] why not value? How to modify, the great god give directions? Is the need to turn the vector The value in private members the inside also? This fine: I don't know function: line (TCHAR * m_name, float m_min, float m_max, Color m_line_color, int m_line_path, int m_line_width) structure when initialized how ~ ~
  • Related