Passing Objects to Constructors and Receiving a Logic Error

This is a discussion on Passing Objects to Constructors and Receiving a Logic Error within the C++ Programming forums, part of the General Programming Boards category; If anyone would be so kind... I do not know why I am receiving the below error. Desired output is ...

  1. #1
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45

    Passing Objects to Constructors and Receiving a Logic Error

    If anyone would be so kind... I do not know why I am receiving the below error. Desired output is also given.

    Code:
    Foobasesbase::Foobasesbase( const string& one, const string& two, const string& three ) 
      : onedata( one ), twodata( two ), threedata( three ) 
    { 
      cout << "Foobasesbase constructor called." << endl; 
    } 
    
    
    Foobase::Foobase( const string& one, const string& two, const string& three, const string& four, 
                      const string& five, const string& six ) 
      : Foobasesbase( one, two, three ), fourdata( four ), fivedata( five ), sixdata( six ) 
    { 
      cout << "Foobase constructor called." << endl; 
    } 
    
    
    Foo:Foo( const string& one, const string& two, const string& three, const string& four,  
             const string& five, const string& six, const string& seven, const string& eight ) 
      : FooBase( FooBasesBase( one, two, three ), four, five, six ), foosev( seven ), fooeig( eight ) 
    { 
      cout << "Foo constructor called." << endl; 
    } 
    
    
    
    // error 
    Foobasesbase constructor called. 
    Foobase constructor called. 
    Foobasesbase destructor called. 
    Foo constructor called. 
    fourdata, fivedata, sixdata, sevendata, eightdata 
    Foo destructor called. 
    Foobase destructor called. 
    Foobasesbase destructor called. 
    
    // desired output 
    Foobasesbase constructor called. 
    Foobase constructor called. 
    Foo constructor called. 
    onedata, twodata, threedata 
    fourdata, fivedata, sixdata, sevendata, eightdata 
    Foo destructor called. 
    Foobase destructor called. 
    Foobasesbase destructor called.
    Thank you.
    Last edited by CaptainMorgan; 11-18-2006 at 04:21 AM.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,459
    Code:
    Foo:Foo( const string& one, const string& two, const string& three, const string& four,  
             const string& five, const string& six, const string& seven, const string& eight ) 
      : FooBase( one, two, three , four, five, six ), foosev( seven ), fooeig( eight )
    maybe?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Drunken Progammer CaptainMorgan's Avatar
    Join Date
    Feb 2006
    Location
    On The Rocks
    Posts
    45
    Ah... thank you.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21