#include<iostream>
#include<cmath>
using namespace std
;
class Test
{
public:
Test(int x
, int y
)
{
m_x
= x
;
m_y
= y
;
}
Test(int x
)
{
m_x
= x
;
m_y
= 0;
}
Test()
{
m_x
= 0;
m_y
= 0;
}
~Test()
{
cout
<< "~test..." << endl
;
}
void printT()
{
cout
<< "x = " << m_x
<< " y = " << m_y
<< endl
;
}
private:
int m_x
;
int m_y
;
};
void test1()
{
Test
t3(100, 300);
t3
.printT();
}
int main(void)
{
Test
t1(10, 20);
t1
.printT();
cout
<< "-------------" << endl
;
Test
t2(100);
t2
.printT();
cout
<< "-------------" << endl
;
Test t3
;
t3
.printT();
test1();
system("pause");
return 0;
}
(完!)
转载请注明原文地址:https://blackberry.8miu.com/read-41076.html