申请表格 我使用C++ Builder。我在控制台应用程序中编写了两个类,我想在VCL表单应用程序中使用这些类
我该怎么做?我是否必须将它们拆分为.cpp和.h文件,然后包含它们?还是有别的办法 更新 这是我的密码:申请表格 我使用C++ Builder。我在控制台应用程序中编写了两个类,我想在VCL表单应用程序中使用这些类,c++,class,vcl,C++,Class,Vcl,我该怎么做?我是否必须将它们拆分为.cpp和.h文件,然后包含它们?还是有别的办法 更新 这是我的密码: class appointment { public: appointment(); appointment(string aName, TDateTime aDate, TDateTime aReminderDateTime, string aType, string aLocation, string aComments, bool aIsImportant)
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;
};
谈论TDateTime数据类型时是否使用相同的上下文?如果是的话,你能给我一个如何使用它们的例子吗 很难说没有看到它们是如何集成到代码中的,但是为每个类创建单独的源文件和头文件并将它们包含在新项目中肯定没有坏处。然后,您还可以使用现有控制台应用程序中包含的相同文件。这样做当然不是一个坏习惯。酷。是否有一个有用的应用程序来执行此操作?或者我应该手动操作。我以前做过,只是需要一些时间,我想知道我是否可以自动化这个过程。@DarrylJanecek我不知道是否有这样的应用程序。就我个人而言,每当我编写一个新类时,我总是为它们分别编写.cpp和.h文件,所以我从来没有这样做过。我已经更新了我的问题。你能看一看吗?@DarrylJanecek接受一个答案,然后不接受它,然后把问题改成问别的问题。对不起。我已经解决了这个问题。我可以发布更多的问题吗?
const std::string& exampleString