|
Тема |
Re: delete / multiple inheritance [re: ~!@$%amp;^*()_+] |
|
Автор |
void* (психопат) |
|
Публикувано | 15.06.05 10:42 |
|
|
подава се адресът на most derived обекта. за да се разбере кой е той трябва да има поне една виртуална функция, а по стандарт за такава е избран деструкторът.
5.3.5 Delete [expr.delete]
1 The delete-expression operator destroys a most derived object (1.8) or array created by a new-expression.
delete-expression:
::opt delete cast-expression
::opt delete [ ] cast-expression
The first alternative is for non-array objects, and the second is for arrays. The operand shall have a pointer type, or a class type having a single conversion function (12.3.2) to a pointer type. The result has type void.
...
3 In the first alternative (delete object), if the static type of the operand is different from its dynamic type, the static type shall be a base class of the operand's dynamic type and the static type shall have a virtual destructor or the behavior is undefined. In the second alternative (delete array) if the dynamic type of the object to be deleted differs from its static type, the behavior is undefined.73)
unsigned
|
| |
|
|
|