#include<iostream>
using std::cout;
using std::endl;
class Point
{
int x;
int y;
public:
Point(){
cout<<"Point() call!"<<endl;
x=y=0;
}
Point(int _x, int _y){
x=_x;
y=_y;
}
};
int main()
{
Point arr[5];
return 0;
}
point* arr[5];
#include<iostream>
using std::cout;
using std::endl;
class Point
{
int x;
int y;
public:
Point(){
cout<<"Point() call!"<<endl;
x=y=0;
}
Point(int _x, int _y){
x=_x;
y=_y;
}
};
int main()
{
Point* arr[5];
for(int i=0; i<5; i++)
{
arr[i]=new Point(i*2, i*3);
new int;
new int[10];
}
for(int k=0; k<5; k++)
{
delete arr[k];
}
return 0;
}
#include <iostream>
using std::cout;
using std::endl;
class Person
{
public:
Person* GetThis(){
return this;
}
};
int main()
{
Person *p1 = new Person();
cout<<"포인터 p1의 주소: "<<p1<<endl;
cout<<"p1의 this: "<<p1->GetThis()<<endl;
Person *p2 = new Person();
cout<<"포인터 p2의 주소: "<<p2<<endl;
cout<<"p2의 this: "<<p2->GetThis()<<endl;
return 0;
}
class Data
{
int aaa;
int bbb;
public :
Data(int aaa, int bbb){
this->aaa = aaa;
this->bbb = bbb;
}
}