View Full Version : copy constructors

04-09-2002, 09:40 AM
ive been told i need to write a copy constructor for the following bit of common code. the problem is i still dont know how to do it despite looking at a few tutorials. the reason i need it is im texture mapping many objects with different textures( 1 texture for each) and using a normal constructor i.e. COGLTexture picName; and setting picName to a texture image for each object will not work. any help would be great. thanks

#include <GL\glaux.h>

class COGLTexture
_AUX_RGBImageRec *Image;
unsigned int GetID();
void LoadFromFile(char *filename);
void SetActive();
int GetWidth();
int GetHeight();
int Width, Height;
unsigned int ID;

04-09-2002, 11:27 AM
Copy constructor is a constructor that takes
a const reference to an object of that type as an argument.

04-09-2002, 11:53 AM
... and copies the >>complete<< content.

This includes memory allocation and memcpy.

As always www.google.com (http://www.google.com) is your friend.