由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 一个inheritance 的问题
相关主题
一个让我比较困惑的问题 c++ inheritenceHow to overload global new operator?
friend function 不能virtual 怎么搞呢?operator overloading (C++)
a simple design questionc++ operator overloading question
why use static function here?请问关于overloading <<
问个overloading new operator的问题问题的根源找到了
question overloading ++ errorGo不支持operator overload
one question about overloading operator deleteambiguous operators in c++
这段code有啥问题?[C++] 入门级问题 increment and decrement operators
相关话题的讨论汇总
话题: class话题: operator话题: new话题: overloaded
进入Programming版参与讨论
1 (共1页)
i*c
发帖数: 1132
1
如果class A is abstract, class B is not a derived class of A.
下面的code可以运行吗?
A* pa=new B();
b********n
发帖数: 609
2
of course not

【在 i*c 的大作中提到】
: 如果class A is abstract, class B is not a derived class of A.
: 下面的code可以运行吗?
: A* pa=new B();

i*c
发帖数: 1132
3
如果A和B都derive from C, 有可能吗?

【在 b********n 的大作中提到】
: of course not
r*******y
发帖数: 290
4
no

【在 i*c 的大作中提到】
: 如果A和B都derive from C, 有可能吗?
N**s
发帖数: 837
5
if 'new' is overloaded, maybe
if '=' is overloaded, maybe

【在 i*c 的大作中提到】
: 如果class A is abstract, class B is not a derived class of A.
: 下面的code可以运行吗?
: A* pa=new B();

X****r
发帖数: 3557
6
No, no.
The new operator and operator new are different. Overloading the latter won't
change the return type of the former.
operator = is not even part of function lookup here. This is a declarator
with an initializer.

【在 N**s 的大作中提到】
: if 'new' is overloaded, maybe
: if '=' is overloaded, maybe

1 (共1页)
进入Programming版参与讨论
相关主题
[C++] 入门级问题 increment and decrement operators问个overloading new operator的问题
why copy assignment operator returns non-const type?question overloading ++ error
one question about structone question about overloading operator delete
想练习一下C++这段code有啥问题?
一个让我比较困惑的问题 c++ inheritenceHow to overload global new operator?
friend function 不能virtual 怎么搞呢?operator overloading (C++)
a simple design questionc++ operator overloading question
why use static function here?请问关于overloading <<
相关话题的讨论汇总
话题: class话题: operator话题: new话题: overloaded