Click here to Skip to main content
15,888,301 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Delay in Image Transfer trough media player encoder! Pin
Mark Salsbery20-Jun-07 5:58
Mark Salsbery20-Jun-07 5:58 
GeneralRe: Delay in Image Transfer trough media player encoder! Pin
Naveen Khanna20-Jun-07 18:55
Naveen Khanna20-Jun-07 18:55 
GeneralRe: Delay in Image Transfer trough media player encoder! Pin
Mark Salsbery21-Jun-07 5:28
Mark Salsbery21-Jun-07 5:28 
QuestionRedistributing Visual C++ Files Pin
Programm3r20-Jun-07 1:32
Programm3r20-Jun-07 1:32 
AnswerRe: Redistributing Visual C++ Files Pin
Hans Dietrich20-Jun-07 3:15
mentorHans Dietrich20-Jun-07 3:15 
GeneralRe: Redistributing Visual C++ Files Pin
Programm3r20-Jun-07 3:37
Programm3r20-Jun-07 3:37 
AnswerRe: Redistributing Visual C++ Files Pin
Mike Dimmick20-Jun-07 3:55
Mike Dimmick20-Jun-07 3:55 
QuestionInterdependent classes in C++ Pin
boffboy20-Jun-07 1:12
boffboy20-Jun-07 1:12 
A very newbie question:

I have two classes for drawing images in windows:

<br />
<br />
class Win<br />
{<br />
	public:<br />
		void DrawImage(Image *img, int x, int y);<br />
		void DrawPixel(int x, int y);<br />
		// etc. etc.<br />
}; <br />
<br />
class Image<br />
{<br />
	private:<br />
<br />
		XImage *ximage;<br />
		Win *win;<br />
<br />
	public:<br />
		Image(Win *window, int w, int h);<br />
		// etc. etc.<br />
		<br />
};<br />


The internals of the Image class depend on the properties of the window on which it is to be drawn, so the Image constructor needs to be passed a Window pointer. The code to draw an image, in the Window class, needs to be passed an Image pointer. A the moment, this doesn't compile (with G++), since the compiler doesn't know about the Image class when it reaches the prototype of the Win::DrawImage method. Swapping around the class definitions obviously doesn't help since it then doesn't know about the Win class when it reaches the constructor of Image.

One solution is to make the image drawing a method of the Image class, but since drawing requires the use of a lot of private data in the Win class, I'd rather keep drawing as part of the Win class.

What is the best way of resolving this problem? I get the feeling that there is some feature of C++ that I don't know about which will tell the compiler about the Image class, and get it to accept an Image *, before it reaches the class definition.

Cheers
AnswerRe: Interdependent classes in C++ Pin
Cedric Moonen20-Jun-07 1:21
Cedric Moonen20-Jun-07 1:21 
GeneralRe: Interdependent classes in C++ Pin
tom groezer20-Jun-07 1:53
tom groezer20-Jun-07 1:53 
GeneralRe: Interdependent classes in C++ Pin
toxcct20-Jun-07 1:56
toxcct20-Jun-07 1:56 
GeneralRe: Interdependent classes in C++ Pin
Cedric Moonen20-Jun-07 2:01
Cedric Moonen20-Jun-07 2:01 
AnswerRe: Interdependent classes in C++ Pin
toxcct20-Jun-07 1:29
toxcct20-Jun-07 1:29 
QuestionDirective Pin
tom groezer20-Jun-07 0:45
tom groezer20-Jun-07 0:45 
AnswerRe: Directive Pin
Cedric Moonen20-Jun-07 0:58
Cedric Moonen20-Jun-07 0:58 
GeneralRe: Directive Pin
toxcct20-Jun-07 1:32
toxcct20-Jun-07 1:32 
GeneralRe: Directive Pin
Cedric Moonen20-Jun-07 1:39
Cedric Moonen20-Jun-07 1:39 
GeneralRe: Directive Pin
tom groezer20-Jun-07 1:43
tom groezer20-Jun-07 1:43 
GeneralRe: Directive Pin
toxcct20-Jun-07 1:51
toxcct20-Jun-07 1:51 
QuestionRetriving Device information attached with system Pin
Karismatic20-Jun-07 0:38
Karismatic20-Jun-07 0:38 
QuestionRe: Retriving Device information attached with system Pin
David Crow20-Jun-07 2:35
David Crow20-Jun-07 2:35 
QuestionRe: Retriving Device information attached with system Pin
Hamid_RT20-Jun-07 9:13
Hamid_RT20-Jun-07 9:13 
QuestionProblem removing object from list Pin
Kevin Brydon20-Jun-07 0:28
Kevin Brydon20-Jun-07 0:28 
AnswerRe: Problem removing object from list Pin
Cedric Moonen20-Jun-07 0:49
Cedric Moonen20-Jun-07 0:49 
GeneralRe: Problem removing object from list Pin
Kevin Brydon20-Jun-07 1:20
Kevin Brydon20-Jun-07 1:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.