r u sure? i don't see anything wrong with the code, other than there shouldn't be a semicolon after main, but it's no biggie.
k*f
5 楼
Nothing is wrong. Compiles fine with g++ and VC++2008. Did you have a typo somewhere?
O*y
6 楼
I am not able to duplicate your syntax errors either. But you need release the memory since you "new" three Circle objects.
n*d
7 楼
You are right. I tried the same code by g++, no error. But VC++ 6.0 gives this error.
【在 k**f 的大作中提到】 : Nothing is wrong. : Compiles fine with g++ and VC++2008. Did you have a typo somewhere?
k*f
8 楼
vc6古董了,换个新的
【在 n**d 的大作中提到】 : You are right. I tried the same code by g++, no error. : But VC++ 6.0 gives this error.
K*n
9 楼
change Shape* sarray[] = {new Circle, new Circle, new Circle}; to Shape* sarray[] = {new Circle(), new Circle(), new Circle()}; VC++ 6.0 compiles without errors.
l*a
10 楼
g++ no problem; Mac OS 10.5 eclipse c++; btw: why dont have a delete for your 'new'?