没人能指点一下迷津么?我的前项引用声明。。。。。。
| 全能ASP/PHP/ASP.NET主机,支持月付 | 专业 MSSQL 数据库空间,支持月付 | 专业 MySQL 数据库空间,支持月付 | 买域名,送MP3、MP4 |
| 高端软件开发 = 年薪十万不是梦 | 赛孚耐:软件保护加密专家 | 身份认证令牌USB KEY | 买空间,免费送域名(厦门中资源) |
没时间了... 明晚来看看... 估计HJin, aipb等很快能给你回答...
祝顺利解决...
/*---------------------------------------------------------------------------
File name: declVSdefn.cpp
Author: HJin (email: fish_sea_bird [at] yahoo [dot] com )
Created on: 7/5/2007 15:18:47
Environment: Windows XP Professional SP2 English +
Visual Studio 2005 v8.0.50727.762
Modification history:
===========================================================================
The following code compiles under MS VS 2005.
defn === definition
decl === declaration
forward decl is used when you need to know the name
of a type before the defn of that type.
If you don't have defn of a type, you can only play with the type name.
You cannot do anything that is meaningful for that type, simply because
you cannot construct an object of that type.
*/
#include <iostream>
#include <string>
using namespace std;
class B; // forward decl
class A
{
public:
void f(B& rObjB, B* pObjB, B objB); // ok --- you declare f() instead of define
/**
wrong --- you are defining g(). need to define B first.
*/
/*
void g(B& rObjB, B* pObjB, B objB)
{
}
*/
private:
//B objB; // wrong --- need to know the defn to allocate memory space for objB
B& rObjB; // reference --- ok
B* pObjB; // pointer --- ok
static B sObjB; // static --- ok
};
int main(int argc, char** argv)
{
return 0;
}



