I have today learned the very useful new feature of C++ 11 which allows direct initialization of data members in the class declaration:
class file_name
{
public:
file_name(const char *input_file_name);
~file_name();
private:
char *file_name=nullptr; //data_member is initialized to nullptr;
char *Allocator(int buffer_size); //code to dynamically allocate requested
//size block of memory.
};
Is it possible to take this a step further with the new v11 rules and initialize a data member with the output of a member function:
class file_name
{
public:
file_name(const char *input_file_name);
~file_name();
private:
char *file_name=Allocator(MAX_PATH); //data_member is initialized with a block of
//dynamic memory of sufficient size to hold
//and valid file name.;
char *Allocator(int buffer_size); //code to dynamically allocate requested
//size block of memory.
};
Would this cause problems?