私は完全に共有ポインタのニュースです。私は1つを初期化しようとしています
std::shared_ptr<Gdiplus::Pen> pen(new Gdiplus::Pen);
しかし、それは型指定子が必要だと言っています...私もこの共有ポインタを通常のポインタに設定しようとしています。誰かがこれがどのように機能するかを私に説明できますか?とても有難い
#pragma once
class Shape
{
public:
Shape();
Gdiplus::Point start;
Gdiplus::Point end;
std::shared_ptr<Gdiplus::Pen> pen(new Gdiplus::Pen());
virtual LRESULT Draw(Gdiplus::Graphics * m_GraphicsImage) = 0;
void setPen(Gdiplus::Pen * pen2) {
pen.get() = pen2;
}
void setStart(int xPos, int yPos) {
start.X = xPos;
start.Y = yPos;
}
void setEnd(int xCor, int yCor) {
end.X = xCor;
end.Y = yCor;
}
};