I'm having a little trouble understanding part of my assignment.
The part is: Create in the private section of the ServerGroup class a pointer to a dynamic integer array called servers.
I've been reading through my book and can't really find much on the subject. Does this look right to anyone?
1 2 3 4 5 6 7 8 9 10 11
#ifndef ServerGroup_h
#define ServerGroup_h
class ServerGroup
{
public:
private:
int *ptr = newint; // needs pointer to a dynamic integer array called servers
};
#endif
I think C++11 allows you to initialize your data variables in the class definition, but I've never been partial to it. But yes, it is correct... if I wasn't wrong about C++11.
Edit:
Oh, but you have a pointer to a single int, not an array.