免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Autodesk 的 c 題(2007.05) - 面試總結(jié) - 堅(jiān)持到底
Autodesk 的 c++題(2007.05)

1. What and why is explicit constructor and explicit copy constructor?

2. What the difference between Struct and Class?

3. What is vitrual function and why we need vtable?

1.

Explicit constructor and copy constructor is used to preventing implicit type cast.

An explicit constructor can not take part in implicit conversions. It can only be  used to explicit construct an object

Consider the Class below:

class A

{

public:

A();

A(int i);

A(A& a);

int i;

virtual ~A();

};

The following program will success to compile :

A a = 10;

or

A a;

a = 10;

because A has a constructor that accept a Int as a arguments

Those codes above are equal to

A tmp(10);    //constructor

a(tmp);      //copy constructor

or

A tmp(10) ;  //constructor

a = tmp;     // operator =

Note: explicit on a constructor with mutiple arguments has no effect,  unless all  but one of the arguments has a default value !

2: differences between struct and class?

3 difference between struct and class

1)members in struct are by default public while members in class are by default  private.

2)inhert  from  a struct is by default public , inhert from a class is by default private.

For example

struct A

{

};

struct B : (public)A

{

} ;

class A

{

};

class B: (private)A

{

};

3)class can be used as typename in template while struct can not

template(class T)      //right

template(struct T)     //wrong

3: What is virtual function and why we need vtable?

1) a virtual function is a function member of a class decleared with a virtual  keyword

2) it usually has a different functionality in the derived class

3) A function is resolved at run-time

The main difference between a non_virtual function and a virtual  function is, the  non_virtual function is resolved at compile time. This  mechanism is called  static_binding.  As the virtual function is  resolved at run time, This mechanism is  know as dynamic_binding

v_table is kind of lookup table.It contains pointers to the virtual  functions provided  by a class, and each object of the class contains a  pointer to its v_table(or  vtables, in some multiple-inheritance  situations)

A v_table is created at compile time,  so whether  a object is referenced by any  pointers or reference, when a virtual  fall happens, the v_table can help the object  find the exact function  address.

 原文地址http://www.unus.cn/career/?p=17465

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
A Basic Glance At The Virtual Table
面試準(zhǔn)備
R6025 runtime error :pure virtual funcion call 原因 (From MSDN)
委托、信號(hào)和消息反饋的模板實(shí)現(xiàn)技術(shù)
Loki庫(kù)使用(1)
c++以代理的方式來(lái)實(shí)現(xiàn)接口化編程
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服