What does "class classname* funcname(void) "mean in C++?
This is an elaborated type specifier:
Elaborated type specifiers may be used to refer to a previously-declared class name (class, struct, or union) or to a previously-declared enum name even if the name was hidden by a non-type declaration. They may also be used to declare new class names.
https://en.cppreference.com/w/cpp/language/elaborated_type_specifier
Taking from answers of Artefacto and dfrib because it brings it on point: It is equivalent to:
class BOOT;
BOOT* boot(void);
In your example it essentially does a forward declaration of the class BOOT if it is not known yet. See this example struct Data* Data;
from the same page:
struct Node {
struct Node* Next; // OK: lookup of Node finds the injected-class-name
struct Data* Data; // OK: declares type Data at global scope
// and also declares the data member Data
friend class ::List; // error: cannot introduce a qualified name
enum Kind* kind; // error: cannot introduce an enum
};
Data* p; // OK: struct Data has been declared
It is the same as this:
class BOOT;
BOOT* boot(void);
So it's a pointer to class BOOT
, but with a declaration of the class as well. The class need not be defined at this point.
What does “class classname* funcname(void) ”mean in C++?
It is a function declaration.
It looks like a declaration of a function, but it begins with "class".
class classname*
is the return type of the function. class classname
is an elaborated type specifier.