English 中文(简体)
C++ 把这个点添加到集装箱内,将其放在基类构造中
原标题:C++ Add this pointer to a container by calling it in base class constructor
  • 时间:2010-06-03 10:23:26
  •  标签:
  • c++
class Base
{
public:
Base (int a, int b);
private:
int a,b;
};

class Derived1
{
public:
Derived1():base(1,2){}
};

类似Derived2, Derived 3, 其中含有自己的数据成员

现在需要把这些衍生物体装在单一州,因此,正想把这种物品放在像基地建筑商这样的基地。

Base::Base(int a, int b)
{
CBaseMgr::GetInstance()->AddtoVector(this);
}

一、建构

单吨集装箱是否含有所有衍生物体?

我怀疑,这是否能够把物体添加到底部的集装箱内,还是应当由衍生器做。

最佳回答

如果所有衍生产品都称为该基类建筑商,那么你应当被罚款。

Just beware of the copy Constructionor, which, if not overloaded, will not Addcode>this to You global path.

我恳请大家从全球病媒中删除被破坏的事件吗?

如果是的话,不要忘记宣布<条码>Base:~Base为virtual,以便他能够按衍生班子接任。

问题回答

只要在进行整个施工之前,在基地的建筑商中不再适用<条码>,就应当予以罚款。

My doubt is can i do this adding of objects to container in base ctor or should i do in derived ctor.?

你们可以安全地在基地建设者中这样做,但你们必须照顾到以下方面:

  • 明确宣布影印造物(如果你想要物体是可复制的、可复制的、可罚款的;如果没有的话,宣布基本复印件为私人的,并且不执行,或者使基地从<代码>boost:不可复制的私下继承。

  • 仓库 基准点名(我猜测你已经知道这一点)。

  • 宣布地下室主人虚拟(他们从经理那里搬走)

  • 确保移除程序不会有任何例外(在销毁方面作出例外规定可能导致将地球变成独一无二的行为或其他未界定的行为......)。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签