c01-file1

来自「C++面向对象课程设计课件」· 代码 · 共 33 行

TXT
33
字号
//File1.cpp文件的源代码

#include <iostream>
#include "File1.h"

//汇入名字空间中的声明
using namespace std;
using namespace namespaceFile1;

//实现Dog类的成员函数
void Dog::Bite() const 
{
	cout<<"A dog is Biting something!"<<endl;
}
void Dog::Sleep() const
{
	cout<<"A dog is Sleeping!"<<endl;
}

//入口函数(主函数) main
int main()
{	
	Dog adog(5);
	adog.Sleep();

	cout<<adog.GetAge()<<endl;
	adog.AddAge(3); 
	cout<<adog.GetAge()<<endl;
	cout<<"The end of this program!\n";
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?