#include <iostream>
using namespace std;
template <class T>
void swap_t(T &num1, T &num2)
{
T temp = num1;
num1 = num2;
num2 = temp;
}
class Point
{
private:
int xp;
int yp;
public:
Point(int x=0, int y=0 ) :xp(x), yp(y)
{ }
void ShowPosition() const
{
cout << xp << ',' << yp << endl;
}
void swap()
{
swap_t(xp, yp);
}
};
int main(void)
{
Point pos1 = (10,17);
pos1.ShowPosition();
pos1.swap();
pos1.ShowPosition();
}
결과값인데 이거 원래 이러냐? 왜 초기화안되고 지랄이야
잘 봤습니다
스왑 잘 됬는데요?>
dd//됬->됐 (되어 = 돼임) [리듬 맞춤법 봇♬]