关于字符指针函数的的一个问题

hugo_sh 2007-11-22 11:04:56
#include <iostream.h>
#include <stdio.h>
class mammal
{
public:
virtual void Call()=0;
void Color(char *color);
void Class(char *cClass);
char* GetColor();
char* GetClass();
private:
char* m_Color;
char* m_Class;

};
class Cat:public mammal
{
public:
void Call();

};
class Dog:public mammal
{
public:
void Call();
};
void mammal::Class(char *cClass)
{
m_Class=cClass;
}
void mammal::Color(char *color)
{
m_Color=color;
}
char* mammal::GetColor
{
return m_Color;
}
char* mammal::GetClass
{
return m_Class;
}
void Dog::Call()
{
cout<<"汪汪!一只"<<GetColor()<<GetClass()<<"\n";
}
void Cat::Call()
{
cout<<"喵喵!一只"<<GetColor()<<GetClass()<<"\n";
}
void main()
{
Cat taotao;
Dog benben;
taotao.Class("波斯猫");
benben.Class("牧羊犬");
taotao.Color("白色");
benben.Color("黑色");
mammal *mam[2]={&taotao, &benben};
for(int m=0;m<2;m++)
{
mam[m]->Call();
}
}
编译时存在这个问题,不知道哪里错了,请高手帮忙,顺便讲一下指针函数,不盛感激
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
...全文
78 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Muf 2007-12-05
  • 打赏
  • 举报
回复
建议你还是向微软件举报。
按你说的,这确实是编译器的bug。

正常的话,此时应该出一个编译期的错误,如C4xxx之类的。而不是internal compiler error.
hugo_sh 2007-12-04
  • 打赏
  • 举报
回复
沐枫,问题我找到了,其实很简单,就是函数实现的时候,在函数名后面少了个(),见彩色那一行,谢谢你的恢复
windskzw 2007-12-03
  • 打赏
  • 举报
回复
迷茫ING。。。。好深奥!!!有点读不下去了。。。
Muf 2007-11-30
  • 打赏
  • 举报
回复
internal compiler error....中奖了
建议 1. 重启机器 2. 查杀病毒 3. 检查是否与杀毒软件或词霸等软件冲突 4. 重装系统或开发工具,或检查开发工具的插件是否有问题 5. 向微软举报编译器的bug.

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧