Ein seltsames CPP-Codebeispiel (vielleicht?) über Typedef aus einem Buch mit dem Titel „The Design and Evolution of C++“C++

Programme in C++. Entwicklerforum
Guest
 Ein seltsames CPP-Codebeispiel (vielleicht?) über Typedef aus einem Buch mit dem Titel „The Design and Evolution of C++“

Post by Guest »

Ich kann statisches Q(P) im folgenden Codebeispiel nicht verstehen:

Code: Select all

typedef int P();
typedef int Q();
class X {
static P(Q); // define Q to be a P.
// equivalent to `static int Q()`
// the parentheses around Q are redundant

// Q is no longer a type in this scope

static Q(P); // define Q to be a function
// taking an argument of type P
// and returning an int.
// equivalent to `static int Q(int())`
}
Meiner Meinung nach bedeutet „Q ist in diesem Bereich kein Typ mehr“ bedeutet, dass Q jetzt ein Funktionsname ist. Warum kann er also wie statisches Q(P) verwendet werden?
Dieses Codebeispiel scheint nicht gültig zu sein (betroffen von der Grammatik).

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post