CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C++ 语言

help:关于类的问题

楼主jznsmail(果冻)2003-10-03 12:36:22 在 C/C++ / C++ 语言 提问

//create.h  
  #ifdef   CREATE_H  
  #define   CREATE_H  
  class   createanddestroy{  
  public:  
  createanddestory(int);  
  ~createanddestory();  
  private:  
  int   data;  
  };  
  #endif  
   
  //create.ccp  
  #include<iostream.h>  
  #include"create.h"  
  createanddestroy::createanddestory   (int   value)  
  {  
  data=value;  
  cout<<"object"<<data<<"constructor";  
  }  
  createanddestroy::~createanddestroy()  
  {  
  cout<<"object"<<data<<"destuctor"<<endl;  
  }  
   
  //main.ccp  
  #include<iostream.h>  
  #include"create.h"  
  int   main()  
  {  
  cout<<"   (golbal   created   before   main)"<<endl;  
  createanddestroy   secnd(1);  
  return   0;  
  }  
   
  VC6.0提示:  
  Deleting   intermediate   files   and   output   files   for   project   'creat   -   Win32   Debug'.  
  --------------------Configuration:   creat   -   Win32   Debug--------------------  
  Compiling...  
  create.cpp  
  d:\book_c++_practice_qianneng\creat\create.cpp(3)   :   error   C2653:   'createanddestroy'   :   is   not   a   class   or   namespace   name  
  d:\book_c++_practice_qianneng\creat\create.cpp(5)   :   error   C2065:   'data'   :   undeclared   identifier  
  d:\book_c++_practice_qianneng\creat\create.cpp(7)   :   warning   C4508:   'createanddestory'   :   function   should   return   a   value;   'void'   return   type   assumed  
  d:\book_c++_practice_qianneng\creat\create.cpp(8)   :   error   C2653:   'createanddestroy'   :   is   not   a   class   or   namespace   name  
  d:\book_c++_practice_qianneng\creat\create.cpp(11)   :   warning   C4508:   'createanddestroy'   :   function   should   return   a   value;   'void'   return   type   assumed  
  main.cpp  
  D:\book_c++_practice_qianneng\creat\main.cpp(6)   :   error   C2065:   'createanddestroy'   :   undeclared   identifier  
  D:\book_c++_practice_qianneng\creat\main.cpp(6)   :   error   C2146:   syntax   error   :   missing   ';'   before   identifier   'secnd'  
  D:\book_c++_practice_qianneng\creat\main.cpp(6)   :   error   C2065:   'secnd'   :   undeclared   identifier  
  Error   executing   cl.exe.  
   
  creat.exe   -   6   error(s),   2   warning(s)  
  请问问题处在那里啊?  
  问题点数:0、回复次数:3Top

1 楼SimplyBest(SimplyBest)回复于 2003-10-03 22:07:04 得分 0

你的类声明里的构造和析够函数名字写错了!!!!Top

2 楼hangdian(欧阳无敌)回复于 2003-10-03 22:25:30 得分 0

是   的,我也发现了,你那ro变or了Top

3 楼dingo2000(小鬼)回复于 2003-10-03 22:59:43 得分 0

createanddestroy::createanddestory   (int   value)  
  晕,前后两个单词不一样 !!!!Top

相关问题

  • help,date类型的问题
  • HELP!函数返回类型.
  • 类!
  • 类
  • 类?!
  • 麻烦的分类检索 高手help !!
  • **c++中的类的继承HELP?
  • help!画类图时遇到的问题!
  • help!!!help!!!help!!!类C数据结构的快速排序问题!!!!!!!!
  • help! JAVA下有类似VC++ 下的socket 类吗?请各位高手看一下!!

关键词

  • createanddestory
  • createanddestroy
  • create
  • cout
  • include
  • data

得分解答快速导航

  • 帖主:jznsmail

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo