All pastes #408675 Raw Edit

Viki

public cpp v1 · immutable
#408675 ·published 2007-03-25 00:52 UTC
rendered paste body
Object.h:#ifndef OBJECT_H#define OBJECT_Hclass Object{public:	Object();	~Object();	int getI(void);	void setInfo(int i,char *name,double coord);private:	int i;	char *name;	double coord;};#endifObject.cpp:#include "Object.h"#include <iostream>using namespace std;Object::Object(){	//cout << "IN CONSTRUCTOR: " << this << " </> " << i << endl;	}Object::~Object(){	//cout << "IN DESTRUCTOR: " << this << " </> " << i << endl;}int Object::getI(void){	return i;}void Object::setInfo(int i,char *name,double coord){	this->i = i;	this->name = name;	this->coord = coord;}main.cpp:#include <iostream>#include <conio.h>#include "Object.h"using namespace std;void main(void){		Object *ptr;	ptr = new Object[6665536];	//cout << endl << "###" << ptr[10].getI() << "###" << endl;	for (int x = 0;x < 6665536;x++)	{		ptr[x].setInfo(rand(),"fdsfsd",(double)(rand() / 3));	}/*	for (int x = 0;x < 65536;x++)	{		cout << "x: " << x << " </> " << ptr[x].getI() << endl;	}*/	delete [] ptr;	char c;	while (true)	{		if (_kbhit())		{			c = _getch();			cout << c;			if (c == '~')				break;		}	}}