Questions tagged [empty-class]
21 questions
0
votes
3 answers
c++ - Does allocating memory to an empty class casues memory leak?
The following function appears in the OctoMap code:
class AbstractOcTreeNode {}; -> They declare an empty class
AbstractOcTreeNode** children; -> This is declared in the OcTreeDataNode class header file
template
void…

RonD
- 26
- 5
0
votes
0 answers
inheritance increases class size
In my experience Pattern 2 in following code nearly always fail and Pattern 1 always succeeds. What part of standard (if any) does guarantee that?
#include
#include
struct Data {
int a;
char b[5];
};
// Pattern…

Swift - Friday Pie
- 12,777
- 2
- 19
- 42
0
votes
1 answer
Can we detect empty classes in C++03?
Possible Duplicate:
Is there an easy way to tell if a class/struct has no data members?
Can we detect emply classes, possibly using template?
struct A {};
struct B { char c;};
std::cout << is_empty::value; //should print 0
std::cout <<…

Nawaz
- 353,942
- 115
- 666
- 851
0
votes
1 answer
JavaScript Empty Setter Method Error
Given this code:
let person = {
_name: 'Lu Xun',
_age: 137
}
Need to add new setter method to change the person's age. I'm trying to add an empty age setter method, but get an error message Unexpected identifier or "Must have at least one…

Charity
- 1
- 1
0
votes
3 answers
Empty Derived Class inherited from Non-Empty Base Class
class Base
{
int i ;
};
class Derived : public Base { } ;
int main()
{
cout << sizeof(Derived);
}
Output :
4
In Base class , since i is private , it should not be inherited to the Derived Class . Hence , the Base class should act as…

Subbu
- 2,063
- 4
- 29
- 42
-4
votes
2 answers
I am creating an empty Java class and compiling it, will any constructor be created
I am creating an empty Java class and compiling it, will any constructor be created as it is being compiles successfully
Class ABC{
}

Pushker Sahay
- 9
- 2