vc++6.0英文版如何给一个已有的类建立一个成员函数
BOOLCCalculatorDlg::OnInitDialog(){CDialog::OnInitDialog();//Add"About..."menuitemtos...
BOOL CCalculatorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CurValue=0; //当前数据值初始化 《——这里总报错
CurRadix=10; //当前进制初始化
return TRUE; // return TRUE unless you set the focus to a control
} 展开
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
CurValue=0; //当前数据值初始化 《——这里总报错
CurRadix=10; //当前进制初始化
return TRUE; // return TRUE unless you set the focus to a control
} 展开
展开全部
写代码就好了,下面是我刚写的一个简单的例子!希望对你有所帮助、、、
#include<iostream>
class student{
public:
student(int n, double s);
~student();
void display(void); //此处是申明成员函数
private:
int no;
double score;
};
student::student(int n, double s){
no = n;
score = s;
}
student::~student(){
}
void student::display(void){//这里是成员函数的实现
cout<<"no = "<<no<<endl;
cout<<"score = "<<score<<endl;
}
int main(){
student stu(10, 87.5);
stu.display();//这里是成员函数的调用
return 0;
}
#include<iostream>
class student{
public:
student(int n, double s);
~student();
void display(void); //此处是申明成员函数
private:
int no;
double score;
};
student::student(int n, double s){
no = n;
score = s;
}
student::~student(){
}
void student::display(void){//这里是成员函数的实现
cout<<"no = "<<no<<endl;
cout<<"score = "<<score<<endl;
}
int main(){
student stu(10, 87.5);
stu.display();//这里是成员函数的调用
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把代码贴上来看看啊
追问
贴了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询