fork(2) download
  1. #include <iostream>
  2.  
  3. struct MoneyData
  4. {
  5. int twenty, ten, five, one, change;
  6. int quarter, dime, nickel, penny;
  7. };
  8.  
  9. struct Money : MoneyData
  10. {
  11. void foo();
  12. Money() : MoneyData() {}
  13. };
  14.  
  15. int main()
  16. {
  17. char storage[120] = "This is filler";
  18. Money* a = new (storage) Money; /* default initialization, not value initialization */
  19. std::cout << a->twenty << ", " << a->ten << ", " << a->penny << "\n";
  20. return 0;
  21. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0, 0, 0