0

I have this line of code which I cannot make sense of.

ClassA *pointer= new( ( char* )BASE_ADDRESS)ClassA ;

What does this cast ( ( char* )BASE_ADDRESS) even mean?

BASE_ADDRESS is some memory location.

πάντα ῥεῖ
  • 85,314
  • 13
  • 111
  • 183
H. Sock
  • 149
  • 9

1 Answers1

4

This is called placement new. It constructs an object of type ClassA and puts it in the memory location specified by BASE_ADDRESS.

R_Kapp
  • 2,768
  • 1
  • 16
  • 29