Re: Me vs. MyClass

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



David,
| Something else occurred to me: calling overridable functions from a
| ctor. Seems pretty obscure though, and again it's providing language
| support for a bad practice.
? puzzled look ?

C# & I believe both Java & C++ all support calling overridable methods in
constructors.

In fact System.Windows.Forms.Form.CreateParams is called from the
constructor! Which is why CreateParams cannot rely on fields initialized in
the constructor as the base constructor calls it before the derived
constructor has a chance for it to run.

I really don't see how MyClass adds or takes away support to calling
overridable methods in constructors...

Of course calling an overridable method in a constructor needs to be done
with caution.

Hope this helps
Jay


"david" <david@xxxxxxxxxxxxxxxx> wrote in message
news:slrndhpm51.hs5.david@xxxxxxxxxxxxxxxxxxxxxxxx
| On 2005-09-05, Jay B. Harlow [MVP - Outlook]
<Jay_Harlow_MVP@xxxxxxxxxxxxx> wrote:
| > David,
| > As I stated:
| >
| > It appears we may need to agree to disagree on MyClass & constructors...
:-|
|
| Agreed.
|
| > If I find additional info on a viable reason to call MyClass outside of
| > constructors I will post it.
|
| Something else occurred to me: calling overridable functions from a
| ctor. Seems pretty obscure though, and again it's providing language
| support for a bad practice.
|
<<snip>>


.



Relevant Pages

  • Re: Me vs. MyClass
    ... >| ctor. ... > the constructor as the base constructor calls it before the derived ... > I really don't see how MyClass adds or takes away support to calling ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Initialize an array of classes?
    ... Currently you cannot use member initialization list for a nonstatic array of a class if it does not have a default constructor. ... however you may encounter the warning C4351 and I do not think that it is useful to use such initialization for an array. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Windows Form Designer generated code
    ... In VS.NET 2003, the part of 'Windows Form Designer generated code' contains a constructor and the InitializeComponent method, and these code is located in the form.vb file. ... You could put your initialization code either in the constructor or the Load event handler of the form. ... The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Object oriented stuff and browsers related thing
    ... with Netscape 2.0 being the first browser to support ... iff MyConstr() is called as a constructor. ... It refers to `MyConstr' as that would be the ...
    (comp.lang.javascript)
  • Re: STL map of structures
    ... to add a default constructor and a copy constructor to my structure.". ... Microsoft Online Community Support ... Please feel free to let my manager ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.dotnet.languages.vc)