Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Singleton mit Vererbung

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe ein kleines Problem mit meinem Design. Ich habe mich für das C++ Forum entschieden, da aus dem Design später einmal eine Win32 DLL in C++ werden soll. Also zum Problem: Ich habe zwei Klassen Vater und Kind. Vater ist als Singleton implementiert:


class Vater 

{

pubilc: 

   Vater* getInstance();

   void releaseInstance();

   ~Vater();

protected:

   static Vater* m_instance;  

   int refCounter;

private:

   Vater();

   Vater(Vater&);

}

So weit so gut. Nun soll - die Namen deuten es sicherlich schon an - das Kind vom Vater erben, ohne das meine Singleton Struktur zerstört wird. Zur Zeit habe ich im Grunde das gleiche noch einmal:

class Kind : public Vater

{

pubilc: 

   Kind * getInstance();

   void releaseInstance();

   ~Kind ();

private:

   Kind ();

   Kind (Kind &);

}

Das Problem das ich dabei sehe: wenn einer einen Vater ein anderes ein Kind braucht und der Vater vor dem Kind erstellt wird müsste eigentlich der Vater erst abgeräumt und das Kind erstellt werden. Außerdem habe ich die Vermutung, dass es irgendwie besser geht. Also, irgend jemand ein paar Ideen?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.