13.01.2015 Views

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

✐<br />

✐<br />

✐<br />

“Volum<strong>en</strong>1” — 2012/1/12 — 13:52 — page 379 — #417<br />

✐<br />

13.1. Creación de objetos<br />

// Malloc with class objects<br />

// What you’d have to do if not for "new"<br />

#include "../require.h"<br />

#include // malloc() & free()<br />

#include // memset()<br />

#include <br />

using namespace std;<br />

class Obj {<br />

int i, j, k;<br />

<strong>en</strong>um { sz = 100 };<br />

char buf[sz];<br />

public:<br />

void initialize() { // Can’t use constructor<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!