confused g++ err msg 'deprecated conversion from string constantto char*'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • G. Peter

    #16
    Re: confused g++ err msg 'deprecated conversion from string constantto char*'



    John Harrison wrote:[color=blue][color=green]
    >>[color=darkred]
    >>>>Just inheriting and (implicit) using the CKR6 ctor can't be the error,
    >>>>can it?
    >>>
    >>>
    >>>Yes, it can, because before the derived classes are initialized, all the
    >>>bases are initialized first. So, the ctro for a derived is something[/color]
    >>[/color]
    > like
    >[color=green][color=darkred]
    >>>this:
    >>>
    >>>struct base {
    >>>base () {} };
    >>>
    >>>struct derived: base {
    >>>derived (): base(base()) { } };
    >>>
    >>>The ctor for derived expands to something like this:
    >>>
    >>>derived () { this->base = base (); }
    >>>
    >>>HTH,
    >>>-Dhruv.
    >>>[/color]
    >>
    >>OK that makes sense.
    >>But what can I do to avid errors here?
    >>
    >>Does it suffice to 'pre'initialize the base class?
    >>
    >>like
    >> main(){
    >>static base myBase( "ttyS0" );
    >>derived myDerived( 2.0 )
    >> }
    >>
    >>I'll try that ...
    >>[/color]
    >
    >
    > I think you've misunderstood Dhruv. There's no need to 'preinitialise' a
    > base class. I think Dhruv was just trying to point out that you are
    > implicitly calling the base class ctor, something you knew already I think.
    >
    > john
    >
    >[/color]
    Yes I knew that :-) but that does not solve my problem.

    Comment

    Working...