Typesafe Collections from CollectionBase 
Author Message
 Typesafe Collections from CollectionBase

I am trying to create a Typesafe collection inheriting
from the CollectionBase class. However the compiler is
throwing out a C3815 error.

public __gc class TestItem
{
public:
        int i;

Quote:
};

[System::Reflection::DefaultMemberAttribute("Item")]
public __gc class Test : public CollectionBase
{
public:

        void Add(TestItem* item)
        {
                List->Add(item);
        }

        __property void set_Item(System::String* index,
TestItem* item)
        {
                int i = System::Int32::Parse(index);

                List->Item[i] = item;
        }

        __property TestItem* get_Item(System::String*
index)
        {
                int i = System::Int32::Parse(index);

                return __try_cast<TestItem*>(this->List-

Quote:
>Item[i]);
        }
};



Tue, 28 Jun 2005 21:47:17 GMT  
 Typesafe Collections from CollectionBase

Quote:

> I am trying to create a Typesafe collection inheriting
> from the CollectionBase class. However the compiler is
> throwing out a C3815 error.

This is fixed in the Everett compiler.  Your code compiles successfully
with VC7.1.

Cheerio!

--
Brandon Bray                                          Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.



Wed, 06 Jul 2005 03:39:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. A collection inside a collection inside a collection...

2. typesafe var sized array.

3. Typesafe macros

4. typesafe downward casting

5. Typesafe C info

6. Suggestion for typesafe MFC message maps

7. MC++ Bug using CollectionBase

8. HOWTO: Derive from CollectionBase

9. CollectionBase vs ICollection

10. CollectionBase memory usage/leakage?

11. Inherit from CollectionBase vs ArrayList

12. Error with CollectionEditor and CollectionBase

 

 
Powered by phpBB® Forum Software