鱼C论坛

 找回密码
 立即注册
查看: 3160|回复: 5

为什么会出现这个错误呢??

[复制链接]
发表于 2013-9-6 11:32:55 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Error!
Program: ...ments\visual studio 2012\Projects\hellocpp\Debug\hellocpp.exe
R6010
- abort() has been called

(Press Retry to debug the application)
---------------------------
中止(A)   重试(R)   忽略(I)   
---------------------------

  1. #include <iostream>
  2. #include <string>

  3. class Animal
  4. {
  5. public:
  6.         std::string name;
  7.         void eat(std::string food);
  8.         void sleep();
  9.         Animal(std::string thename);
  10.         ~Animal();

  11. };

  12. void Animal::eat(std::string food){

  13.         std::cout << "我正在吃" << food << std::endl;
  14. }

  15. void Animal::sleep(){

  16.         std::cout << "我正在睡觉,不要打扰我!" << std::endl;
  17. }

  18. Animal::Animal(std::string thename){

  19.         name = thename;
  20. }

  21. Animal::~Animal(){}

  22. //*********************************

  23. class Pig:public Animal{

  24. public:
  25.         void run();
  26.         Pig(std::string thename);
  27.         ~Pig();
  28. };

  29. void Pig::run(){

  30.         std::cout << "我正在奔跑!" << std::endl;
  31. }

  32. Pig::Pig(std::string thename):Animal(name){}
  33. Pig::~Pig(){};

  34. //*********************************

  35. class Turtle:public Animal{

  36. public:
  37.         void swim();
  38.         Turtle(std::string thename);
  39.         ~Turtle();
  40. };

  41. void Turtle::swim(){

  42.         std::cout << "我正在游泳!" << std::endl;
  43. }

  44. Turtle::Turtle(std::string thename):Animal(name){}
  45. Turtle::~Turtle(){}

  46. //***********************************


  47. int main()
  48. {

  49.         Pig pig("小猪猪");
  50.         Turtle turtle("小乌龟");

  51.         std::cout << "我是" << pig.name << std::endl;
  52.         pig.eat("水果");
  53.         pig.sleep();
  54.         pig.run();

  55.         std::cout << "我是" << turtle.name << std::endl;
  56.         turtle.eat("鱼");
  57.         turtle.sleep();
  58.         turtle.swim();


  59.         return 0;
  60. }
复制代码

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2013-9-6 12:04:50 | 显示全部楼层
真巧,我也在鱼C学习


                               
登录/注册后可看大图
来自 睇我头像好空虚好寂寞加好鬼死冻 的新浪微博
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-9-6 12:04:50 | 显示全部楼层
回复@睇我头像好空虚好寂寞加好鬼死冻:在学习什么呢?师兄


                               
登录/注册后可看大图
来自 敉沧-MeeSong 的新浪微博
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-9-6 12:04:50 | 显示全部楼层
回复@敉沧-MeeSong:师兄就说不上啦。。我现在都是看看python和PE结构


                               
登录/注册后可看大图
来自 睇我头像好空虚好寂寞加好鬼死冻 的新浪微博
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-9-6 14:21:41 | 显示全部楼层
回复@睇我头像好空虚好寂寞加好鬼死冻:我跟着珈珈对你的称呼来称呼的。我是c++和python。


                               
登录/注册后可看大图
来自 敉沧-MeeSong 的新浪微博
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2013-9-6 14:21:41 | 显示全部楼层
回复@睇我头像好空虚好寂寞加好鬼死冻:还有数据结构


                               
登录/注册后可看大图
来自 敉沧-MeeSong 的新浪微博
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-29 03:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表