一、 在Demo.h中声明一个类Demo
#include "stdafx.h"
#include <iostream>
class Demo
{
//构造函数
public:
Demo()
{
}
//示例函数
public:
int DoSomething()
{
std::cout<<"This is the demo";
return 1;
}
};
二、直接引用声明的类,#include "Demo.h"
// Demos.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "iostream"
#include "Demo.h"
int _tmain(int argc, _TCHAR* argv[])
{
//Demo类的对象
Demo demo;
//调用函数
demo.DoSomething();
getchar();
return 1;
}