本文介绍了Ctype fire默认构造函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如果我试图将一个物体投射到它的一个后代上,那么 后代的默认构造函数(New sub)会被点燃吗? 谢谢, Craig 解决方案 如果你/ cast /一个对象:没有。 Casting不会创建一个新对象,它只会改变引用的类型。如在主题中所提到的,CType可以同时执行两个(与仅投射的Directcast相反):转换和转换(通常 混合)。如果CType创建一个新对象,是的,构造函数将被调用。如果CType只投射:没有新实例 - >没有构造函数叫 - Armin 如何报价及原因: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html (经常混淆)。如果CType创建一个新对象,是的,将调用构造函数。如果CType只投射:没有新实例 - >没有构造函数叫 - Armin 如何引用和原因: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html If I am trying to cast an object to one of its decendants, will thedecendants'' default constructor (New sub) fire? Thanks, Craig 解决方案 If you /cast/ an object: no. Casting does not create a new object, it onlychanges the type of the reference. CType, as mentioned in the subject, cando both (in opposite to Directcast that only casts): cast and convert (oftenmixed up). If CType creates a new object, yes, the constructor will becalled. If CType only casts: no new instance -> no constructor called--Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html (often mixed up). If CType creates a new object, yes, the constructor will be called. If CType only casts: no new instance -> no constructor called -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html 这篇关于Ctype fire默认构造函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 17:56