Sunday, 8 September 2013

How to initialize class member array with 0

How to initialize class member array with 0

I have the next class and want to initialize _operators array with 0:
//Entity.h
class Entity
{
static const unsigned short operatorTypeColumn = 1;
static const unsigned short outputValueColumn = 4;
private:
mainDataType _operators[operatorsMaxCount][operatorsTableWidth];
}
//Entity.cpp. I thought this should work in C++ v11
Entity::Entity(void) : _operators[operatorsMaxCount][operatorsTableWidth]
{
}
I thought this sold work in C++ v11 but i got error... how can i
initialize array with 0.. with ugly for? i don't want make it static

No comments:

Post a Comment