A class that has been declared without a class-head-name.
Questions tagged [unnamed-class]
10 questions
33
votes
2 answers
Can unnamed structures inherit?
The following looks like a compilation error :
struct : Base { };
Yet when used [1] it seems to work :
#include
using namespace std;
template
struct A
{
struct : std::integral_constant {
} members;
};
int…

Nikos Athanasiou
- 29,616
- 15
- 87
- 153
5
votes
1 answer
How to call a non-default parent constructor from an unnamed derived class in C++?
In C++, single use structures and classes can be declared unnamed, if an object is created directly:
struct { int x; int y; } point;
Unnamed classes may also inherit from a base class. This is for example useful to create a list of different…

Kai Petzke
- 2,150
- 21
- 29
5
votes
2 answers
Can an unnamed struct be made static?
Can you make an unnamed struct a static member of a class?
struct Foo
{
struct namedStruct
{
int memb1, memb2;
};
static namedStruct namedStructObj;
struct
{
int memb1, memb2;
}…

Zebrafish
- 11,682
- 3
- 43
- 119
2
votes
1 answer
JS unnamed class and its unnamed extended class
Operation class creates an array like this, which has no class name before the array.
[operInputQuery[0].value, operInputQuery[1].value, operInputQuery[2].value]
'Table' class is purposed to be an unnamed class inheriting Operation's…

Just Doo
- 91
- 8
2
votes
0 answers
Instance of unnamed class in unnamed namespace
Using functors with parameters generally looks like that:
// Definition:
struct some_functor_with_params
{
int ref;
explicit some_functor_with_params(int ref) : ref(ref) {}
bool operator ()(int i) const {return i == ref;}
};
//…

Christophe Fuzier
- 689
- 5
- 11
1
vote
1 answer
C++ Utilizing dot syntax to call function on "Property" (unnamed class)
Goal
My objective is to call StaticLibrary::func() from the property (unnamed class) on Environment using the dot syntax.
For example:
env.bar.func();
I have been able to achieve static_cast(env.bar).func();, which is close, but the…

Zak
- 12,213
- 21
- 59
- 105
1
vote
2 answers
Forward declaration of anonymous typedef with bitfields in C++
I found an answer for a forward declaration of a typedef in C++ (https://stackoverflow.com/a/2095798). But my situation looks like this:
// a.h
typedef struct{
unsigned char bah0 : 1;
unsigned char bah1 : 1;
unsigned char bah2 : 1;
…

ge45mue
- 677
- 8
- 23
0
votes
0 answers
Multiple Unnamed Nested Classes
class grphD::App
{
...
protected:
class
{
...
} console_handler;
class
{
...
} grid;
};
How can I access App::console_handler inside App::grid functions without…

DarkoNaito_09
- 71
- 2
- 12
0
votes
3 answers
named class expressions returning different values
I want to know why there is difference between the outputs of the following classes.
I have tried following code to get the class values in console. For one particular case(the last console) I am wondering how this is returning this value.
let…

Abhishek Parashar
- 91
- 1
- 6
-1
votes
1 answer
What unnamed calss access rules question On different sub class
Super simple chain store flow statistics logic .
Parent class handle unname Object instance .
Parent class has different sub class .
In a different sub class, access parent class's unname Object, I don't know why the two unname Object are same…

Tom
- 333
- 2
- 8