我在读c ++入门书。但是在一个类的示例中,它使用类作为标头。
#include<iostream>
#include"sales_item.h" //here, it uses class as header
int main()
{
Sales_item total;
if(std::cin>>total) {
sales_item trans;
while(std::cin>>trans) {
.....
因此,请告诉我如何使用它,以便可以在CodeBlocks IDE中对其进行编译。
在示例中,使用标头作为标头。:)就是说,类定义放置在单独的标头中sales_item.h
,该标头包含在使用类定义的模块中。该类本身的名称为Sales_item
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句