constructor-chaining
In C# 4, how can I have constructors with optional parameters in a subclass of a parent with an overloaded constructor?
I have a parent class that has an overloaded constructor, and I have a subclass that has a constructor with optional parameters. Is there a way to have the subclass\'s constructors still expose the ov[详细]
2023-03-03 04:45 分类:问答SCJP v6 (Sierra,Bates) Chapter 2, Question 12 Interpretations of constructor calls
Could I have some feedback on this Given \"new House(\"x \")\" sends a string I had expected that the \"House(String name)\" constructor would have called the Building super class constructor \"Build[详细]
2023-02-26 01:03 分类:问答C# constructor chaining - changing the order of execution
I want to know how to change the order of execution when chaining constructors in C#.The only methods I have seen require the chained constructor to be called first, outside of the current constructor[详细]
2023-02-19 20:15 分类:问答Constructor chaining in conjunction with the base constructor invocation
Say I have the following: class Base { public Base (int n) { } public Base (Object1 n, Object2 m) { } } class Derived : Base {[详细]
2023-02-13 19:24 分类:问答Chaining constructors in JavaScript
I\'m trying to implement some kind of class hierarchy in JavaScript. I think I understood the prototype chain, but I still have to sort out the[详细]
2023-01-21 12:57 分类:问答Delphi: How to add a different constructor to a descendant?
Update: The example i originally had was kind of complex. Here\'s a simple 8 line example开发者_StackOverflow that explains everything in one code block. The following does not compile gives a warning[详细]
2023-01-19 04:02 分类:问答Delphi: Understanding constructors
i\'m looking to understand virtual override overload reintroduce when applied to object constructors. Every time i randomly add keywords until the compiler shuts up - and (after 12 years of develo[详细]
2023-01-18 20:17 分类:问答Delphi: How to hide ancestor constructors?
Update: gutted the question with a simpler example, that isn\'t answered by the originally accepted answer[详细]
2023-01-18 19:32 分类:问答: this() As a constructor
I\'m trying to get a better understanding of general practice... specifically deriving this() in a constructor.I understand that its less code, but I consider it less readable.Is it common/g开发者_Sta[详细]
2023-01-12 02:15 分类:问答Is this a good or bad way to use constructor chaining? (... to allow for testing)
My motivation for chaining my class constructors here is so that I have a default constructor for mainstream use by my application and a second that allows me to inject a mock and a stub.[详细]
2022-12-24 03:02 分类:问答