Projekt

Allgemein

Profil

Feature #663

ducoment tipps and tricks

Von Maximilian Seesslen vor etwa 9 Stunden hinzugefügt.

Status:
Neu
Priorität:
Normal
Zugewiesen an:
-
Zielversion:
-
Beginn:
04.07.2025
Abgabedatum:
% erledigt:

0%

Geschätzter Aufwand:
CS Zielversion:

Beschreibung

#include <stdio.h>

class C1
{
    int i1;
    public:
        constexpr 
        //consteval
        C1(int _i1)
            :i1(_i1)
        {
            printf("Init!\n");
        };
        void print() const
        {
            printf("Value: %d\n", i1);
        }
};

// const constexpr C1 c_c1{20};
// const C1 c_c1{20};

int main(int argc, const char* argv[])
{
   C1 c_c1{20};
   c_c1.print();
   return(0);
};

constexpr: optinally, compiler can decide
consteval: Force it!

Auch abrufbar als: Atom PDF