Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

hi, so im doing c plus plus. beginner level course and we are using the gui inte

ID: 3619599 • Letter: H

Question

hi, so im doing c plus plus. beginner level course and we are using the gui interface using fltk library. so my question is i need to call a funciton "draw". this is how i have declared it.

//pre- takes a window as a parameter.
//post- Draws the objects required to display this Gauge to be attached to the window.
void data::draw(void (*Simple_window)(Point xy, int w, int h, const string& title) );

i have a class named "data" and in the main this is what i do.

data a; // declare an instance of the class.

Simple_window win(Point(100,100),a.xmax,a.ymax,"CONSOLE DISPLAY OF FORD F150");

a.draw(win);


and this is the error i get: error C2664: 'data::draw' : cannot convert parameter 1 from 'Simple_window' to 'void (__cdecl *)(Point,int,int,const std::string &)' C:Documents and SettingsAdministratorDesktop 3.5seismoseismosrcmain.cpp 168

please help as this assignment is due very soon! any comments will be helpfull.

Explanation / Answer

//hope you will understand your problem, otherwise reply with same. draw is taking a function address returning void. void data::draw(void (*Simple_window)(Point xy, int w, int h, const string& title) ); but you are passing win function returning type of Simple_window. Simple_window win(Point(100,100),a.xmax,a.ymax,"CONSOLE DISPLAY OF FORD F150"); a.draw(win);