Redian新闻
>
C++ 请教: about the memory layout of the class inheritance
avatar
C++ 请教: about the memory layout of the class inheritance# Programming - 葵花宝典
h*r
1
有没有那位可以贴一下US-NEWS的文科排名啊?
比如,想知道美国哪些学校的比较文学专业比较好?
多谢了!
avatar
m*i
2
A summer intern is needed at a brokerage firm for 3 months on web
development projects. The job site is located in New Jersey. The following
are the requirements:
1. Familar with C#, ASP, .NET Web Development, must be an experienced web
developer or have developed rich interactive web sites.
2. Client Side Javascripts, AJAX.
3. MS SQL stored procedure development.
4. Hands on development job.
If interested, please send resume to my mitbbs mail account.
avatar
O*l
3
请教这里的C++ guru们,谁能解释一下以下几种C++继承中的基类和继承类在内存中是什
么样的结构:
class A
{
int fieldA;
int func();
}
class B : class A
{
int fieldB;
int func();
}
1. inheritance without virtual functions
[This I know] the memory layout is as simple as: [fieldA fieldB]
2. inheritance with virtual functions
[Not quite clear] looks like in debugger memory [vtprA fieldA fieldB]
should there be a vtable pointer for B?
3. multiple inheritance if there is a class C:A and a class D:B, C
4. multiple inheritance with virtual
avatar
E*7
4
#include
using namespace std;
class Top {
protected:
int x;
public:
Top(int n) { x = n; }
virtual ~Top() {}
friend ostream&
operator<return os << t.x;
}
};
class Left : virtual public Top {
protected:
int y;
public:
Left(int m, int n) : Top(m) { y = n; }
};
class Right : virtual public Top {
protected:
int z;
public:
Right(int m, int n) : Top(m) { z = n; }
};
class Bottom : public Left, public Right {
int w;
public:
Bottom(int
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。