[comp.lang.c++] problems...

marcb@eyrie.img.uu.oz.au (Marc A. Boschma [Tau]) (11/24/90)

Help ! :-)

I have the following bit of code that does not want to compile. I know that
the compiler can not determine which constructor to call for the virtual
base class FgBox (FgBox is a class in the Zortech C++ v2.1 flash graphics
library).

The problem I have is that I can not see how to tell the compiler which
constructor to call for the FgBox. [ FgBox's constructors are:
FgBox(fg_coord_t, fg_coord_t, fg_coord_t, fg_coord_t) and
FgBox(fg_const_pbox_t) ]

Here is the code:

#include <fg.hpp>

class GUI_View : virtual public FgBox {
public:

    GUI_View(fg_coord_t x1, fg_coord_t y1, fg_coord_t x2, fg_coord_t y2)
		: (x1, y1, x2, y2) {}
    GUI_View(fg_const_pbox_t pbox) : (pbox) {}

    virtual ~GUI_View()	{}

	// kill drawc and erasec for this class
    virtual void drawc(fg_const_pbox_t clip) {}
    virtual void erasec(fg_const_pbox_t clip) {}

    virtual void draw(void)	{ drawc(box()); /* clip to view */ }
    virtual void erase(void)	{ erasec(box()); }


    operator fg_const_pbox_t () { return box(); }

};

#include <dlist.hpp>

typedef GUI_View *GUI_View_Ptr;

declare(zGDList, GUI_View_Ptr);
declare(zGDLCursor, GUI_View_Ptr);

typedef zGDList(GUI_View_Ptr) GUI_View_List;
typedef zGDLCursor(GUI_View_Ptr) GUI_View_Cursor;

class GUI_Canvas : GUI_View {
protected:
    GUI_View_List children;
public:

    GUI_Canvas(fg_coord_t x1, fg_coord_t y1, fg_coord_t x2, fg_coord_t y2,
		GUI_View* child) : GUI_View(x1, y1, x2, y2)
		{ children.linkin(&child); }
    GUI_Canvas(fg_const_pbox_t pbox) : GUI_View(pbox) {}

    virtual ~GUI_Canvas()	{}

    void add_view(GUI_View * GV) { children.linkin(&GV); }

    virtual void drawc(fg_const_pbox_t clip);
    virtual void erasec(fg_const_pbox_t clip);
    virtual void translate(fg_coord_t x, fg_coord_t y = 0);

};

> Compiler error message...

kanella::\cpp> ztcpp1 -ms -oC:\temp\ztc_33G.tmp gcanvas
};
^
"gcanvas.hpp", line 37 Syntax error: not found or ambiguous reference to function 'FgBox'

--- errorlevel 1

Any pointers, answers etc. would be of a great help!

------------------------------------------------------------------------------
Marc A. Boschma                                       marcb%eyrie@labtam.oz.AU
Systems Development                                   img Consultants
                                                      GPO Box 3304GG
                                                      Melbourne, Victoria 3000
                                                      Australia