该程序使用定位 new运算符在相邻的内存单元中创建两个对象,并调用了合适的析构函数。
#pragma region 12.9 placenew2.cpp
//placenew2.cpp -- new placement new,no delete
#if 1
#include <iostream>
#include <string>
#include<new>
using namespace std;
const int BUF = 512;
class JustTesting
{
private:
string words;
int number;
public:
JustTesting(const string& s = "Just Testing"