Re: if derived class adds an argument to ctor, does that need to carry up to the base classes?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 08/19/04


Date: Thu, 19 Aug 2004 16:27:25 -0400


"hazz" <hazz@sonic.net> wrote in message
news:O%23oM1bihEHA.636@TK2MSFTNGP12.phx.gbl...
> I have a class/constructor hiearchy that functions correctly as
illustrated
> below (thanks to Ken Kolda's earlier newsgroup assistance.) If a client
> instantiates object D, eg. D m_D = new D(str_arg), it climbs up the ctor
> stack until B(string str) handles it.
>
> A();
>
> B();
> B(string str)
> {
> do_string_Stuff; }
>
> C();
> C(string str) : base(str);
>
> D();
> D(string str) : base(str);
>
> Now for the change. I have a class that has this ctor signature.
> D ( long n_arg, string str) // :base(str) won't work anymore. will
> it have to be :base(n_arg, str)

It does has to work !
It will also work :this( str) which call the other constructor of D

Cheers,

-- 
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Relevant Pages

  • Re: Comments please
    ... > printdate(str); ... > Segmentation fault ... not on the stack. ... this behavior - its just a curious side effect of compiler architecture ...
    (comp.lang.c)
  • Re: whether this is valid
    ... located in data segment which is read only. ... And your *a is a pointer (located in your stack that means it be able ... This variable pointed to address that "str" located. ... you in stack and copy "str" from data segment to that memory. ...
    (comp.lang.c)
  • Re: Problem using string pointer
    ... constant stored somewhere or other and str is a pointer (put on the ... C or C++ languge specification says where " ADGFR" should be stored, ... bytes on the stack for str[] and copies " ADGFR" into it. ...
    (microsoft.public.vc.language)
  • Re: Small Script - [WILDPACKET]
    ... > I know nothing about VB Scripting. ... > inventory file from client pc's to an in house FTP Server. ... Download details: Windows Script Documentation ... > objTextFile.write str ...
    (microsoft.public.scripting.vbscript)
  • Unused stack space
    ... In a C module that I have compiled, it seems to generate object files ... which waste stack space. ... (to pass the str parameter to printf), ...
    (comp.os.linux.development.apps)