本文中包含了一些常用的代码片断,看看想想或许有他山之石可以攻玉的可能。 CKER
删除别名中所有的表
void TData::CleanTemp()
{
TStringList *myTables = new TStringList();
TTable *Table = new TTable(this);
try
{
Session->GetTableNames(\"Temp\", \"\", True, False, myTables);
}
catch (...) {}
// AnsiString str = myTables->GetText();
// ShowMessage(str);
for(int count=0; count < myTables->Count; count++)
{
Table->DatabaseName = \"Temp\";
Table->TableName = myTables->Strings[count];
Table->Close();
Table->DeleteTable();
}
delete myTables;
delete Table;
}
BACK
纯虚函数
//纯虚函数只在基类中出现,而在子类中必须有
//与其匹配的成员函数。程序中申明的子类的实例
file://必须为基类中的每一个纯虚函数提供一个重载的成员函数。
class TBaseClass
{
public:
virtual void Display() = 0;
};
class TDerivedClass : public TBaseClass
{
public:
void Display() { ShowMessage(\"From Derived\"); }
};
class TSecondDerivedClass : public TDerivedClass
{
public:
void Display() { ShowMessage(\"From Second Derived\"); }
};
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDerivedClass dc; dc.Display();// \"From Derived\"
TSecondDerivedClass sc; TBaseClass* bc = ≻