Created
October 11, 2015 12:25
-
-
Save segfo/af7bde1bb1750a308ded to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include"TestClass.h" | |
using namespace std; | |
int main() { | |
static char buf[sizeof(TestClass)*10]; | |
cout << sizeof(TestClass) << endl; | |
TestClass *t1 = new(buf) TestClass("AAAAAAA"); | |
TestClass *t2 = new(buf+sizeof(TestClass)) TestClass("BBBBBBB"); | |
cout << "buf : "; | |
cout << (void*)buf << endl; | |
t1->Print(); | |
t2->Print(); | |
getchar(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment