[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Compiler Fejl ved abstrakte klasser



Mandag den 26. april 2004 22:42 skrev Allan Nielsen:
> Hej
>
> Jeg er gået i gang med at programmer et program som i første omgang skal
> kunne tolke en string bestående af et matematisk udtryk, og retuner det
> beregnet tal, f.eks 2*3+4 = 10.
> Til at gøre dette har jeg lavet følgende klasser heraki:
> Operator som er den øverste klasse, og som er erklaret abstrakt,
> Operator1, Operator2, Operator3, Operator4  ... som arver fra Operater
> klassen, disse er også abstrakte klasser.
> Tilsidst er der de matematiske operator, plus, minus, gange, osv,  som
> arver fra Operator2 pågrund af at de tager 2 arkumenter.
>  sin(), ln(), sqrt() , osv. arver fra Operator1 da de kun tager 1 argument.
> Operator0, er normale tal.
>
> compiler siger følgende:
> f1(Operator*, Operator*)':
> */home/allan/Projects/cpp/stringmath2/src/stringmath2.cpp:19: error:
> `Operator' is an inaccessible base of `Oplus'
> */home/allan/Projects/cpp/stringmath2/src/stringmath2.cpp: I function
> 'Operator*
> *f2(Operator*, Operator*)':
> */home/allan/Projects/cpp/stringmath2/src/stringmath2.cpp:24: error:
> `Operator' is an inaccessible base of `Ominus'
> */home/allan/Projects/cpp/stringmath2/src/stringmath2.cpp: I function 'int
> *main(int, char**)':
> */home/allan/Projects/cpp/stringmath2/src/stringmath2.cpp:40: error:
> `Operator' is an inaccessible base of `Operator0'
> *make[2]: *** [stringmath2.o] Fejl 1
>


Hej Allan.

Du skal nok gøre sådan her


class Operator0 : public Operator
{
  public:
    int i;

    Operator0(int i, Operator * parent);
    
    double getDouble();

    ~Operator0();

};


Læg mærke til at Operator arves public.

mvh
Søren


-- 
http://sgh.dk    |                Linux
   SGH.DK        |    Where do you want to go tomorrow


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *