Bar: 'class' type redefinition compile time error

Discussion in 'C++' started by A, Oct 22, 2003.

  1. A

    A Guest

    Hi,

    I created an array of user defined objects dynamically in a class Foo's
    constructor.

    class Foo{

    Foo(){
    Bar* b = new Bar();
    }

    It gave me a "no default constructor for object Bar" so i added it like so:

    class Bar{

    Bar(){}; //added this one
    Bar(double d1, double d2){...};
    }

    now i get a
    Bar: 'class' type redefinition compile time error.



    Any helps appreciated.

    REgards

    dsf
    A, Oct 22, 2003
    #1
    1. Advertising

  2. Re: 'class' type redefinition compile time error

    "A" <> wrote in message news:...
    > Hi,
    >
    > I created an array of user defined objects dynamically in a class Foo's
    > constructor.
    >
    > class Foo{
    >
    > Foo(){
    > Bar* b = new Bar();
    > }
    >
    > It gave me a "no default constructor for object Bar" so i added it like so:
    >
    > class Bar{
    >
    > Bar(){}; //added this one


    No semicolon here.

    > Bar(double d1, double d2){...};


    Same here
    > }

    ;
    Semicolon here.

    >
    > now i get a
    > Bar: 'class' type redefinition compile time error.
    >
    >
    >

    HTH,
    J.Schafer
    Josephine Schafer, Oct 22, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    0
    Views:
    3,540
  2. John Hann
    Replies:
    0
    Views:
    6,073
    John Hann
    Aug 21, 2004
  3. Matt
    Replies:
    9
    Views:
    70,830
  4. Son
    Replies:
    0
    Views:
    782
  5. Matt
    Replies:
    9
    Views:
    541
    kaeli
    Aug 23, 2004
Loading...

Share This Page