一定是bc.exe了。
举个例:
先建立。类头文件Box.h,类实现文件Box.cpp,使用box的类的Boxes2.cpp。下面使用BC3.1的项目。
0、先建立好Box.h、Box.cpp、Boxes2.cpp。之后Windows->Close All
1、建立项目,Project->Open Project,之后输入一个项目名Box.prj
2、加入文件,Project->Add Item,依次加入Boxes2.cpp和Box.cpp(预先Compile成Box.obj也可以)。
项目中的每个文件也可以单独Compile,双击项目栏中每个文件,则其内容程序可显示。obj文件不可。
// BOX.H Box interface
class box {
int length;
int width;
public:
box(void); //Constructor
void set(int new_length,int new_width);
int get_area(void) {return(length*width);}
~box(void); //Destructor
};
//Rusult of execution
//
//This header file cannot be compiled or executed
main()
{
box small,medium,large; // Three boxes to work with
small.set(5,7);
// Note that the medium box uses the values
// supplied by the constructor
large.set(15,20);
cout<<"The small box area is "<<small.get_area()<<"\n";
cout<<"The medium box area is "<<medium.get_area()<<"\n";
cout<<"The large box area is "<<large.get_area()<<"\n";
}
// Result of execution
//
// The small box area is 35
// The medium box area is 35
// The large box area is 35