C++: Use pointer from abstract class for accessing method of derived classes; derived class apears to be abstract as well
<p>I have looked for 2 hours now (mainly on this site) to understand my problem I have while coding in C++. I have a abstract base class which looks like this:</p>

<h3>Screen.hpp</h3>

<pre><code>#include &lt;SFML/Graphics.hpp&gt;

class Screen {
public:
   virtual ~Screen();

   virtual void Init() const = 0;
   virtual void Render(sf::RenderWindow &amp;window) const = 0;
   virtual void Update(sf::RenderWindow &amp;window, sf::Time &amp;deltaTime) const = 0;
   virtual void EventTriggered(sf::RenderWindow &amp;window, sf::Event &amp;event) const = 0;
};
</code></pre>

<p>Next I have declared a class which derives from the base class:</p>

<h3>Splashscreen.hpp</h3>

<pre><code>#include "Screen.hpp"

class Splashscreen : public Screen {
public:
   Splashscreen();
   ~Splashscreen();

   void Init();
   void Update(sf::RenderWindow &amp;window, sf::Time &amp;deltaTime);
   void Render(sf::RenderWindow &amp;window);
   void EventTriggered(sf::RenderWindow &amp;window, sf::Event &amp;event);

private:
   sf::Sprite *_splashSprite;
};
</code></pre>

<p>And finally I want to create a new Splashscreen object and assign the address to a pointer from the base class:</p>

<pre><code>void Game::Init() {
   Screen* ptrScreen = new Splashscreen;
   _displayMgr.AddScreen("Splash", ptrScreen);
   _displayMgr.ChangeScreen("Splash");
}
</code></pre>

<p>As I mentioned before, I looked this problem up already and found a ton of solutions and came up with this what I have now. But I still get an error in the line </p>

<pre><code>Screen* ptrScreen = new Splashscreen;
</code></pre>

<p>while compiling that says following:</p>

<pre><code>error: invalid new-expression of abstract class type 'Splashscreen'
</code></pre>

<p>I just don't understand this, because I have defined all declared methods that are mentioned in Splashscreen.hpp right here:</p>

<h3>Splashscreen.cpp</h3>

<pre><code>#include "SplashScreen.hpp"

Splashscreen::Splashscreen() {}
Splashscreen::~Splashscreen() {}

void Splashscreen::Init() {}
void Splashscreen::Update(sf::RenderWindow &amp;window, sf::Time &amp;deltaTime) {}
void Splashscreen::Render(sf::RenderWindow &amp;window) {}
void Splashscreen::EventTriggered(sf::RenderWindow &amp;window, sf::Event &amp;event) {}
</code></pre>

<p>I hope someone can help me and forgive me, if this question was already to many times. But it is hard to change your "mind of programming" when you change from Java to C++. But I already like C++ better :) It is challenging and I like that a lot.</p>

<h2>[EDIT]:</h2>

<p>I only changed the following: <br/></p>

<pre><code>class Splashscreen : public Screen {
public:
   Splashscreen();
   ~Splashscreen();

   void Init() const;
   void Update(sf::RenderWindow &amp;window, sf::Time &amp;deltaTime) const;
   void Render(sf::RenderWindow &amp;window) const;
   void EventTriggered(sf::RenderWindow &amp;window, sf::Event &amp;event) const;

private:
   sf::Sprite *_splashSprite;
};
</code></pre>

<p>The others are still the same.</p>