From the C ++ standard (5.3.1 Unary operators)
1 * : , , lvalue, , . " T", - "T". [: ( cv void). lval ( , ); prvalue, . 4.1. -end note]
int &r = *(new int(100));
lvalue, * , .
,
delete &r;
.
#include <iostream>
int main()
{
struct A
{
virtual ~A()
{
std::wcout << "A::~A()" << std::endl;
}
};
struct B : A
{
~B()
{
std::wcout << "B::~B()" << std::endl;
}
};
A &ra = *(new B);
delete &ra;
}
B::~B()
A::~A()