Statische Membervariable mit privatem Typ intialisieren



  • Okay, habe einen privaten Konstruktor übersehen.
    Es funktioniert, der Thread kann geschlossen werden.
    Das fällt mir natürlich eine Minute nach Eröffnen des Threads auf und nicht davor. 🙄

    ___

    Originalpost:

    Hallo,
    mein C++ ist gerade ziemlich eingerostet und ich würde mich über Hilfe freuen. 🙂

    class Foo {
    	class Bar {};
    	static Bar bar;
    };
    Foo::Bar Foo::bar;
    

    So geht das nicht da Foo::Bar eben private ist. Habe auf die Schnelle dazu nichts gefunden, wie ist die korrekte Syntax dazu?

    Danke und schöne Grüße,
    Ethon


  • Mod

    Nur der Vollständigkeit halber:

    <a href= schrieb:

    [class.access]/6">All access controls in Clause [class.access] affect the ability to access a class member name from the declaration of a particular entity, including parts of the declaration preceding the name of the entity being declared and, if the entity is a class, the definitions of members of the class appearing outside the class's member-specification.


Anmelden zum Antworten