1
General / inheritance problem
« on: February 05, 2010, 06:00:39 pm »
PLEASE LOOK AT MY NEXT POST. THIS POST IS NOT UP TO DATE.
Sorry Guys. This is more like a C++ beginners question but maybe you could help me out. Im trying to build a class with inheritance. I read a few online tutorials about it but i dont get the point.
I tried to draw a circle with the class sf::Shape but my compiler keeps screaming "undefined reference to `Asteroid::Asteroid()'"
So here is the code:
main.cpp
Sorry Guys. This is more like a C++ beginners question but maybe you could help me out. Im trying to build a class with inheritance. I read a few online tutorials about it but i dont get the point.
I tried to draw a circle with the class sf::Shape but my compiler keeps screaming "undefined reference to `Asteroid::Asteroid()'"
So here is the code:
Code: [Select]
#ifndef _ASTEROID_H
#define _ASTEROID_H
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
class Asteroid : public sf::Shape {
private:
public:
Asteroid();
Asteroid(const Asteroid& orig);
virtual ~Asteroid();
};
#endif /* _ASTEROID_H */
Code: [Select]
#include "Asteroid.h"
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
double radiAsteroid = 50;
Asteroid::Asteroid() {
sf::Shape::Circle(400, 400, radiAsteroid, sf::Color(255, 255, 255));
}
Asteroid::Asteroid(const Asteroid& orig) {
}
Asteroid::~Asteroid() {
}
main.cpp
Code: [Select]
Asteroid asteroidclass;
Game.Draw(asteroidclass);