|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Dec 2004
Città: Fabriano(AN)
Messaggi: 21
|
[C++] Estendere classe System::Collections::ArrayList
Salve a tutti!
Per il mio progetto C++ mi serve di creare una classe (chiamata EntityList), che effettui l'estensione della classe System::Collections::ArrayList, come ho fatto in questo esempio: Codice:
class EntityList : public ArrayList{
private:
.....
public:
.....
Codice:
error C3625: 'EntityList': an unmanaged type cannot derive from a managed type 'System::Collections::ArrayList' P.S. In java, con la classe java.util.ArrayList basta fare Codice:
public class EntityList extends ArrayList{}
Aiuto please |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Dec 2003
Messaggi: 4908
|
public ref class EntityList : public ArrayList
PS: Non è C++, è C++/CLI |
|
|
|
|
|
#3 |
|
Junior Member
Iscritto dal: Dec 2004
Città: Fabriano(AN)
Messaggi: 21
|
E se tale arrayList voglio farla diventare un arrayList di oggetti "Entity" invece che un arrayList di "object" come devo fare?
In java bastava fare: Codice:
public class EntityList extends ArrayList<Entity> |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Quote:
Potenza del marketing Microsoft. ArrayList in .NET è una collection di object, dovresti usare l'equivalente generics List. In C++ invece ammesso di aver definito una classe ArrayList<T> banalmente sarebbe stato: class EntityList : public ArrayList<Entity> Ma più probabilmente: class EntityList : public std::vector<Entity> |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 12:30.




















