此文件仅包含此类的声明。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<body>
<div id="container">
<img src="yyy.jpg">
<img src="aaa.jpg">
<img src="bbb.jpg">
<img src="ccc.jpg">
<img src="ddd.jpg">
<img src="eee.jpg">
</div>
</body>
</html>
此文件包含所有API的定义。
在构思中,我们使用对象bb
的成员初始化器class Test
{
private:
Types::A a;
B bb; // B stands for class B { // some objects;};
C cc; // C "
D dd; // D "
CString str;
public:
Test();
void getADetails();
int getBDetails();
void getCDetails();
void getDDetails();
};
此文件包含用于创建该类对象的测试用例。
Test::Test() :bb(Log) // bb constr expects a static log func, all other constrs doesn't contain any parameters
{
}
int Test::getCDetails()
{
this->cc.getDetails(this->str, this->A);
return 0;
}
当我尝试编译代码时,它会产生编译时错误。请在下面的跟踪中找到:
错误26错误C2227:左边的&#39; - &gt; B&#39;必须指向class / struct / union / generic类型
错误28错误C2227:左边的&#39; - &gt; C&#39;必须指向class / struct / union / generic类型
任何人都可以解释一下,因为我是c ++的新手。
答案 0 :(得分:1)
您需要访问成员变量(通过this
),而不是类型。
像这样:
this->aa
this->bb
this->cc
此外,在您的情况下,this
不是必需的。