Thread: Array of classes within class definition

  1. #1
    Registered User subdene's Avatar
    Join Date
    Jan 2002

    Array of classes within class definition

    Does anyone know how to get this code to work? It compiles fine in Visual Studio, but not in Borland. I need this to work in Borland.
    All I want to do is locally decare an array of classes within a class, and initalise them to their relevant values. However, in Borland I keep getting these errors:

    [C++ Error] TJunction.h(21): E2034 Cannot convert 'A' to 'A[3]'
    [C++ Error] TJunction.h(28): E2176 Too many types in declaration

    class A
        A(int i) : m_i(i) {}
        int m_i;
    class B
        B() : m_A(A(1), A(2), A(3)) {}
        A m_A[3];
    Any help would be greatful
    Be a leader and not a follower.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 05:01 PM
  4. dynamic array of base class pointers
    By Corrington_j in forum C++ Programming
    Replies: 1
    Last Post: 11-16-2003, 05:58 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM