L
Lilith
I need to know if I'm doing something wrong here.
I'm working with a library called SFML, an API for presenting
graphics. I'm trying to inherit from a class called Image in order to
make the class an is-a rather than a has-a entity.
Here's the code, slightly stripped down to show just the constructor.
#include "SFML\Graphics.hpp"
class Grid : public sf::Image
{
public:
Grid (int w, int h, sf::Color c) : sf::Image(w, h, c)
{
return;
}
};
When the parent construct is invoked I get the following unhandled
exception:
Unhandled exception at 0x0000000f in MakeRoads.exe: 0xC0000005: Access
violation reading location 0x0000000f.
If I remove the invocation of the parent constructor I still get an
error but it comes later when I try to plot a point that's outside the
image size (0 x 0 by default) because the image didn't get initialized
by the parent constructor.
Anyone see the error of my approach?
I'm working with a library called SFML, an API for presenting
graphics. I'm trying to inherit from a class called Image in order to
make the class an is-a rather than a has-a entity.
Here's the code, slightly stripped down to show just the constructor.
#include "SFML\Graphics.hpp"
class Grid : public sf::Image
{
public:
Grid (int w, int h, sf::Color c) : sf::Image(w, h, c)
{
return;
}
};
When the parent construct is invoked I get the following unhandled
exception:
Unhandled exception at 0x0000000f in MakeRoads.exe: 0xC0000005: Access
violation reading location 0x0000000f.
If I remove the invocation of the parent constructor I still get an
error but it comes later when I try to plot a point that's outside the
image size (0 x 0 by default) because the image didn't get initialized
by the parent constructor.
Anyone see the error of my approach?