免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块
楼主: smallcat1
打印 上一主题 下一主题

华为公司招聘C/C++/Java人才... [复制链接]

论坛徽章:
0
21 [报告]
发表于 2004-05-19 00:20 |只看该作者

华为公司招聘C/C++/Java人才...

现在是做工程的,但是喜欢做开发,给楼主发了封简历,看看合不合适。

论坛徽章:
0
22 [报告]
发表于 2004-05-19 09:47 |只看该作者

华为公司招聘C/C++/Java人才...

第二个问题是:

class CashierQueue : virtual public Queue
{
}

virtual 代表什么意思?

论坛徽章:
0
23 [报告]
发表于 2004-05-19 10:08 |只看该作者

华为公司招聘C/C++/Java人才...

说明Queue是父类的实现其他功能的一个函数,此处virtual作用是说明可以直接访问父类,并且可以重置此函数的功能。没怎么用过,可能也没怎么说清楚呵呵

论坛徽章:
0
24 [报告]
发表于 2004-05-19 10:29 |只看该作者

华为公司招聘C/C++/Java人才...

看看MSDN

C++ Language Reference   

Virtual Base ClassesSee Also
Multiple Base Classes
Because a class can be an indirect base class to a derived class more than once, C++ provides a way to optimize the way such base classes work. Virtual base classes offer a way to save space and avoid ambiguities in class hierarchies that use multiple inheritance.

Each nonvirtual object contains a copy of the data members defined in the base class. This duplication wastes space and requires you to specify which copy of the base class members you want whenever you access them.

When a base class is specified as a virtual base, it can act as an indirect base more than once without duplication of its data members. A single copy of its data members is shared by all the base classes that use it as a virtual base.

When declaring a virtual base class, the virtual keyword appears in the base lists of the derived classes.

Consider the class hierarchy in the following figure, which illustrates a simulated lunch line.

Simulated Lunch-Line Graph



In the figure, Queue is the base class for both CashierQueue and LunchQueue. However, when both classes are combined to form LunchCashierQueue, the following problem arises: the new class contains two subobjects of type Queue, one from CashierQueue and the other from LunchQueue. The following figure shows the conceptual memory layout (the actual memory layout might be optimized).

Simulated Lunch-Line Object



Note that there are two Queue subobjects in the LunchCashierQueue object. The following code declares Queue to be a virtual base class:

// deriv_VirtualBaseClasses.cpp
class Queue
{
    // Member list
};

class CashierQueue : virtual public Queue
{
    // Member list
};

class LunchQueue : virtual public Queue
{
    // Member list
};

class LunchCashierQueue : public LunchQueue, public CashierQueue
{
    // Member list
};

int main()
{
}
The virtual keyword ensures that only one copy of the subobject Queue is included (see the following figure).

Simulated Lunch-Line Object with Virtual Base Classes



A class can have both a virtual component and a nonvirtual component of a given type. This happens in the conditions illustrated in the following figure.

Virtual and Nonvirtual Components of the Same Class



In the figure, CashierQueue and LunchQueue use Queue as a virtual base class. However, TakeoutQueue specifies Queue as a base class, not a virtual base class. Therefore, LunchTakeoutCashierQueue has two subobjects of type Queue: one from the inheritance path that includes LunchCashierQueue and one from the path that includes TakeoutQueue. This is illustrated in the following figure.

Object Layout with Virtual and Nonvirtual Inheritance



Note   Virtual inheritance provides significant size benefits when compared with nonvirtual inheritance. However, it can introduce extra processing overhead.
If a derived class overrides a virtual function that it inherits from a virtual base class, and if a constructor or a destructor for the derived base class calls that function using a pointer to the virtual base class, the compiler may introduce additional hidden "vtordisp" fields into the classes with virtual bases. The /vd0 compiler option suppresses the addition of the hidden vtordisp constructor/destructor displacement member. The /vd1 compiler option, the default, enables them where they are necessary. Turn off vtordisps only if you are sure that all class constructors and destructors call virtual functions virtually.

The /vd compiler option affects an entire compilation module. Use the vtordisp pragma to suppress and then reenable vtordisp fields on a class-by-class basis:

#pragma vtordisp( off )
class GetReal : virtual public { ... };
#pragma vtordisp( on )
See Also
Multiple Base Classes



--------------------------------------------------------------------------------

Send feedback on this topic to Microsoft

& Microsoft Corporation. All rights reserved.

论坛徽章:
0
25 [报告]
发表于 2004-05-19 11:31 |只看该作者

华为公司招聘C/C++/Java人才...

呵呵,跟我理解的差不多。

论坛徽章:
0
26 [报告]
发表于 2004-05-19 11:56 |只看该作者

华为公司招聘C/C++/Java人才...

你说的是virtual 的基本用法,没有说到关键点上。

When a base class is specified as a virtual base, it can act as an indirect base more than once without duplication of its data members. A single copy of its data members is shared by all the base classes that use it as a virtual base.

论坛徽章:
0
27 [报告]
发表于 2004-05-19 13:34 |只看该作者

华为公司招聘C/C++/Java人才...

呵呵

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
28 [报告]
发表于 2004-05-19 13:41 |只看该作者

华为公司招聘C/C++/Java人才...

大家快些努力,好机会来了

论坛徽章:
0
29 [报告]
发表于 2004-05-19 15:44 |只看该作者

华为公司招聘C/C++/Java人才...

[quote="lgqdcs"]其实想要招人,可以看看他在CU发的帖子,就能够大概了解此人的水平了,这样更能全面了解。[/quote]
如果方便请推荐几个人,谢谢!

论坛徽章:
0
30 [报告]
发表于 2004-05-19 15:50 |只看该作者

华为公司招聘C/C++/Java人才...

2004年发展规划

1、了解各种系统的设计模式和其关键技术的实现,使自己对系统的设计水平有质的提高

2、提高对电信业务领域的理解(3G 、NGN)

3、提高自己的专业技术领域的技能(C++、ORACLE开发、CORBA和UNIX),通过阅读ACE/TAO近千万行的源代码掌握大型系统的设计和关键技术的实现

4、写一篇基于CORBA的实时客服系统的论文
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP