Guten Tag liebe Epvper,
und wie ihr im Titel seht hab ich ein Problem:
Ich habe eine Klasse:
Die ich an eine andere Klasse vererben möchte:
In der Main ruf ich das ganze so Auf:
Doch dies Funktioniert nicht so ganz wie ich will:

Bitte um Hilfe!
Danke im schonmal!
und wie ihr im Titel seht hab ich ein Problem:
Ich habe eine Klasse:
Code:
#pragma once
template <typename T>
class PublicClass
{
public:
static T *instance();
static void deleteInstance();
private:
static T *m_instance;
};
Code:
#include "PublicClass.h"
template <typename T>
T *PublicClass<T>::m_instance = nullptr;
template <typename T>
T *PublicClass<T>::instance()
{
if (m_instance == nullptr)
m_instance = new T();
return m_instance;
}
template <typename T>
void PublicClass<T>::deleteInstance()
{
if (m_instance != nullptr)
delete m_instance;
}
Code:
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include "PublicClass.h"
#include <iostream>
class Configuration : public PublicClass<Configuration>
{
public:
Configuration(){}
~Configuration(){}
void test() {std::cout << "test";}
}
private:
};
#endif // CONFIGURATION_H
Code:
Configuration::instance()->test();
Doch dies Funktioniert nicht so ganz wie ich will:

Bitte um Hilfe!
Danke im schonmal!






