I want to write an c++ class that wraps a c struct. Here is a simple example for a c struct:
struct POINT {
  long x;
  long y;
}
Now I am assuming this following class, but I am not sure if it is "performant" nor good c++ style. I didnt want to use a unnecessary variable or function call. It would be very nice if you improve my code :).
The basic idea behind this class is that it is just a wrapper/ handler for the struct. Thats why setStruct and getStruct can modify the private data directly and that it is just a pointer. The other members are always named set<Attribute> and get<Attribute>.
If you use setStruct the only disadvantage I can think of is that the struct could be delete due to scopes so that the pointer is "invalid".
namespace wrapper {
class POINT {
  ::POINT * POINT_;
public:
  POINT() {
    POINT_ = new ::POINT;
  }
  ~POINT() {
    delete POINT_;
  }
  inline void setX( long x ) {
    POINT_->x = x;
  }
  inline long getX() {
    return POINT_->x;
  }
  inline void setY( long y ) {
    POINT_->y = y;
  }
  inline long getY() {
    return POINT_->y;
  }
  inline void setStruct(::POINT * __POINT) {
    POINT_ = __POINT;
  }
  inline ::POINT * getStruct() {
    return POINT_;
  }
};
}
 
     
     
    