由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Is there any error in the code below?
相关主题
Question about a TICPP example请教一个static 函数的问题
c++环境入门问题C++ Q96: function inheritance (转载)
[合集] (c++)为什么不能把这个function的definition放到class里c++ namespace求指教
Smart Parser/Compiler Developmentbiuld error of C# reference of namespace in two projects (转载)
template question问个问题 (转载)
c++古怪问题。。。。 (转载)pointer to base class = new derived, what will happend??
问个程序问题function declaration
题2effective C++里的memory pool 一问:
相关话题的讨论汇总
话题: class话题: any话题: error话题: below话题: int
进入Programming版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
using namespace std;
class CLASS
{
public:
CLASS(int x=0);
CLASS(double);
};
int x=0;
CLASS *array = new CLASS[x];
int main()
{
return 0;
}
c**********e
发帖数: 2007
2
The correct answer: No, it shows the correct way to allocate
an array of CLASS objects.
However, there is an error running the code. Any guru can tell why?
z****e
发帖数: 2024
3
what are you talking about?
you didn't provide any definition of the constructor so when you attempt to
realize an object, of course you can not because the compiler doesn't know
how to.

【在 c**********e 的大作中提到】
: The correct answer: No, it shows the correct way to allocate
: an array of CLASS objects.
: However, there is an error running the code. Any guru can tell why?

1 (共1页)
进入Programming版参与讨论
相关主题
effective C++里的memory pool 一问:template question
why do we still use dynamic allocation?c++古怪问题。。。。 (转载)
为什么用try catch不住exception?问个程序问题
关于内存泄漏题2
Question about a TICPP example请教一个static 函数的问题
c++环境入门问题C++ Q96: function inheritance (转载)
[合集] (c++)为什么不能把这个function的definition放到class里c++ namespace求指教
Smart Parser/Compiler Developmentbiuld error of C# reference of namespace in two projects (转载)
相关话题的讨论汇总
话题: class话题: any话题: error话题: below话题: int