Multiple constructor problem.

Discussion in 'C' started by meyup, May 21, 2010.

  1. meyup

    meyup New Member

    Joined:
    Feb 15, 2010
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    In one program if multiple constructor exists then there multiple problem exists. How could i recover it?
     
  2. techinspiration

    techinspiration New Member

    Joined:
    Feb 14, 2010
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    0
    Hello, can anyone give me a solution for the following problem?????????

    I have a class Teller with two possible constructors : Teller() and
    Teller(int base)
    Then I have a class TellerInc that is based on the class Teller, also with
    two possible constructors: TellerInc() and TellerInc(int step).
    Into the main I want to create an object of TellerInc and give a value for
    the step and the base (thus I have to create the TellerInc(int step) that
    gets the Teller(int base))

    The header file of Teller:

    The header file of Tellerinc:
    Into the main:
    TellerInc tel(step):Teller(base); error: TellerInc undeclared
     
  3. techme

    techme New Member

    Joined:
    Feb 15, 2010
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    Hello, can anyone give me a solution for the following problem?????????
    >
    > I have a class Teller with two possible constructors : Teller() and
    > Teller(int base)
    > Then I have a class TellerInc that is based on the class Teller, also with
    > two possible constructors: TellerInc() and TellerInc(int step).
    > Into the main I want to create an object of TellerInc and give a value for
    > the step and the base (thus I have to create the TellerInc(int step) that
    > gets the Teller(int base))[/color]

    Then TellerInc needs another constructor with 2 arguments:
    * the step, which is used by TellerInc
    * the base, which is passed to Teller

     
  4. meyup

    meyup New Member

    Joined:
    Feb 15, 2010
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    Thanks for replying.
    It helps me a lot.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice