C++ Declaring an uninitialized variable without a null constructor
- by xbonez
Consider the DUPoint class, whose declaration appears below. Assume this code appears in a file named DUPoint.h:
#include <string>
class DUPoint {
public:
DUPoint (int x, int y);
int getX () const;
int getY () const;
void setX (int x);
void setY (int y);
void print();
private:
int x_;
int y_;
};
Is it true that you cannot declare an uninitialized DUPoint variable with a statement such as DUPoint P; using this class as currently configured because it has no null constructor?