asylu3
20-11-2004, 07:48 PM
Constructer คือ ส่วนหนึ่งของ Class ที่จะถูกเรียกโดยอัตโนมัติหลังจากที่สร้าง object
#include < iostream.h >
class obj
{
public:
obj()
{
cout<<" obj created.n";
}
~obj()
{
cout<<" obj destroyed.n";
}
};
int main()
{
obj a =new obj();
return 0;
}
output
obj created
obj destroyed
Powered by vBulletin® Version 4.2.5 Copyright © 2026 vBulletin Solutions Inc. All rights reserved.