Using this objdct

J

JoeC

I created a simple graphic and I store them in arrays of differnet
objects. I know that I am using windows libraries but my question has
nothing to do with that. Here is the heading of my graphic object:

#include<windows.h>
#include<iostream>
#include<string>

#ifndef GRAPHIC_H
#define GRAPHIC_H

class graphic{
int btmap;
int lr,ud; //Diminsion (size) of the graphic
HBITMAP hbitmap;
HDC hdc, hdcmem;

public:
graphic();
graphic(BYTE c[]);
void SetGr(BYTE c[]);
void display(HWND, int, int);

};

#endif

And I want to use my graphic here:

graphic gr;

for(int l2 = 0; l2 < num; l2++){
for(int l1 = 0; l1 < num; l1++){
gr = maze->display(l2, l1); //get the gr object from the
container
gr.display(hwnd, l1*spacing, l2*spacing);
//calls the display function from the graphic.

Basicaly I want to return the graphic from the container. Do I need a
copy constructor or to overload = operator or do I need a copy
constructor? Basically how do I get this to work or how could I do
this better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top