以新方式交还的衍生产品,其类型可归入基类点。
这是否真实或虚假?
我知道有活力的预测会被用于 down。 一般来说,如何将一个衍生等级的点推到基级的点子?
以新方式交还的衍生产品,其类型可归入基类点。
这是否真实或虚假?
我知道有活力的预测会被用于 down。 一般来说,如何将一个衍生等级的点推到基级的点子?
是的。 从点子向衍生物类别转换到点子级是默示的。 因此,以下措施完全是罚款:
struct B { };
struct D : B { };
D* my_d_ptr = new D;
B* my_d_ptr_as_a_b_ptr = my_d_ptr;
暗指向基点的点人。 这是多吗? 一个衍生产品类别的例子应始终作为基础类别的一个实例安全使用。 因此,没有必要作出明确表述。
如果产阶级公开而非虚拟地继承基数,情况就是这样:
页: 1 (Ccast将做这项工作,但你在使用这一黑客之前应两次思考!)
class Base { };
class Derived : protected Base { };
int main()
{
Base* b = new Derived(); // compile error
}
如果基类模棱两可,也不会有工作:
class Base { };
class Derived1 : public Base { };
class Derived2 : public Base { };
class MostDerived : public Derived1, Derived2 { };
int main()
{
Base* b = new MostDerived(); // won t work (but you could hint compiler
// which path to use for finding Base
}
Edit: 添加编码样本,添加模棱两可的使用案例,删除了虚拟继承例子。
你的问题并不明确,因为它混杂了几个不同的东西。
一方面,向下级(can)的点子转换为基级(假定基数可以进入)。 这是一种自然的转变,不需要任何东西。
另一方面,请参见<代码>dnamic_cast及其履行
...... 与此同时,你谈论的是投下<条码>新条码>的结果,当然,这种结果只能加以预测,但不能降幅。
因此,你问什么? 预测或预测?
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 ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
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 ...
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?
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->...
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, ...
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 ...
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?