C++ビルダーを使用しています。コンソール アプリケーションで 2 つのクラスをコーディングしました。これらのクラスを VCL フォーム アプリケーションで使用したいと考えています。
どうすればいいですか?それらを .cpp および .h ファイルに分割してから含める必要がありますか? それとも別の方法がありますか?
アップデート
これが私のコードです:
class appointment
{
public:
appointment();
appointment(string aName, TDateTime aDate, TDateTime aReminderDateTime, string aType,
string aLocation, string aComments, bool aIsImportant)
{
appName = aName;
appDateTime = aDate;
appReminderDateTime = aReminderDateTime;
appType = aType;
appLocation = aLocation;
appComments = aComments;
appIsImportant = aIsImportant;
}
void setAppName(string aName)
{
appName = aName;
}
void setAppDateTime(TDateTime aDateTime)
{
appDateTime = aDateTime;
}
void setappReminderDateTime(TDateTime aReminderDateTime)
{
appReminderDateTime = aReminderDateTime;
}
void printAppointmentDetails()
{
cout << "Appintment Date: " << appDateTime << endl;
cout << "Appintment Reminder Date: " << appReminderDateTime << endl;
cout << "Appintment Type: " << appType << endl;
cout << "Appintment Location: " << appLocation << endl;
cout << "Appintment Comments: " << appComments << endl;
if (appIsImportant)
{
cout << "Appintment IsImportant: " << "Yes" << endl;
} else {
cout << "Appintment IsImportant: " << "No" << endl;
}
}
void setAppType(string aType)
{
appType = aType;
}
void setAppLocation(string aLocation)
{
appLocation = aLocation;
}
void setAppComments(string aComments)
{
appComments = aComments;
}
void setAppIsImportant(bool aIsImportant)
{
appIsImportant = aIsImportant;
}
string getAppName()
{
return appName;
}
TDateTime getAppDateTime()
{
return appDateTime;
}
TDateTime getAppReminderDateTime()
{
return appReminderDateTime;
}
string getAppType()
{
return appType;
}
string getAppLocation()
{
return appLocation;
}
string getAppComments()
{
return appComments;
}
bool getAppIsImportant()
{
return appIsImportant;
}
private:
//appointment();
string appName;
TDateTime appDateTime;
TDateTime appReminderDateTime;
string appType;
string appLocation;
string appComments;
bool appIsImportant;
//person owner;
};
文字列では、.cpp ファイルで以下が使用されることを知っています。
const std::string& exampleString
TDateTime データ型について話すときに同じコンテキストが使用されますか? もしそうなら、それらの使用方法の例を教えてください。