hello, i'm trying to create subclasses to a class, but i get the same error to all my subclasses: expected class-name before*'{' token. Ive checked on other threads and site since it seems that this problem is very common. here is my code:
MoyenDeTransport.h:
class MoyenDeTransport
{
double litre;
public:
MoyenDeTransport(double);
double getLitre();
//void parcourir(int distance);
};
class MoyenDeTransport
{
double litre;
public:
MoyenDeTransport(double);
double getLitre();
//void parcourir(int distance);
};
To copy to clipboard, switch view to plain text mode
and here is my subclass:
Camion
class Camion: public MoyenDeTransport
{
public:
Camion();
};
class Camion: public MoyenDeTransport
{
public:
Camion();
};
To copy to clipboard, switch view to plain text mode
as a matter of fact, i get one warning and one error:
warning: In File included from camion.cpp:1,
error: expected class-name before*'{' token
here is my camion.cpp:
#include "camion.h"
Camion::Camion()
{
}
#include "camion.h"
Camion::Camion()
{
}
To copy to clipboard, switch view to plain text mode
and just in case, here is my MoyenDeTransport.cpp:
#include "moyendetransport.h"
MoyenDeTransport::MoyenDeTransport(double ammount)
{
litre = ammount;
}
#include "moyendetransport.h"
MoyenDeTransport::MoyenDeTransport(double ammount)
{
litre = ammount;
}
To copy to clipboard, switch view to plain text mode
I dont think i'm doing anything flagrantly wrong, but i'm sure its one small thing that i'm missing...
What do you guys think?
Paat
Bookmarks