标题:Declaration terminated incorrectly这个错误代码是什么意思呀.
只看楼主
yiming313140172
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-12-14
 问题点数:0 回复次数:5 
Declaration terminated incorrectly这个错误代码是什么意思呀.
//test 16_5.cpp
//这是一个虚函数示例,我原封不动的写入.结果就是编译不了.系统提示错误在第76行.求各位大侠帮忙!#include <iostream.h>
class caribbean
  {
    public:
    virtual void other_attractions(void)
       {
    cout<<" .........";
       }
  };

class bahamas:public caribbean
  {
    public:
    void other_attractions(void)
      {
     cout........";
      }
  };

class grand_cayman:public caribbean

  {
    public:
    void other_attractions(void)
      {
    cout,,,,,,  };


class st_thomas:public caribbean
 {
 public:
 void other_attractions(void)
   {
     cout<<" ..........
};



  main(void)
    {
      caribbean islands,*ptr;
      bahamas package_1;
      grand_cayman package_2;
      st_thomas package_3;

      ptr=&islands;
      ptr->other_attractions();

      ptr=&package_1;
      ptr->other_attractions();

      ptr=&package_2;
      ptr->other_attractions();

      ptr=&package_3;
      ptr->other_attractions();
      return(0);
                                 // 第76行
                  
     }

*error [color=DarkOrange]16_5.cpp 76 Declaration terminated incorrectly[/color]

[[italic] 本帖最后由 yiming313140172 于 2007-12-15 18:09 编辑 [/italic]]
搜索更多相关主题的帖子: Declaration incorrectly terminated 代码 
2007-12-14 21:28
yiming313140172
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-12-14
得分:0 
是这样的么
没有人知道么.我真郁闷.都两天了
2007-12-15 19:25
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
代码很不规范,也不标准,你贴的是源代码?

Fight  to win  or  die...
2007-12-15 20:00
mfkpgfsbihc
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-11-25
得分:0 
#include<iostream.h>
class caribbean{
    public:
    virtual void other_attractions(void){
        cout<<" .........";
       }
  };

class bahamas:public caribbean{
 public:
    void other_attractions(void) {
     cout<<"........";
      }
  };

class grand_cayman:public caribbean {
 public:
    void other_attractions(void){
        cout<<",,,,,, " ;}
};
   

class st_thomas:public caribbean{
public:
    void other_attractions(void){
        cout<<" ..........";}
};

main(void)
{
   caribbean islands,*ptr;
   bahamas package_1;
   grand_cayman package_2;
   st_thomas package_3;

   ptr=&islands;
   ptr->other_attractions();

   ptr=&package_1;
   ptr->other_attractions();

   ptr=&package_2;
   ptr->other_attractions();

   ptr=&package_3;
   ptr->other_attractions();
   return(0);
 }

没错啊
2007-12-15 20:10
yiming313140172
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-12-14
得分:0 
是的
省略号是一些COUT的内容,我没写.
2007-12-16 13:19
lonmaor
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:郑州
等 级:版主
威 望:75
帖 子:2637
专家分:6423
注 册:2007-11-27
得分:0 
没看内容。
当把
#include<iostream.h>
改成
#include<iostream>
using namespace std;
之后,在DEV C++中调试通过。
2007-12-16 14:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-192492-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.767140 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved