# Vector.\<T\> and Interfaces

**URL:** <https://forum.kirupa.com/t/vector-t-and-interfaces/285632>\
**Category:** flash\
**Created:** [April 3, 2009, 8:40am UTC](https://forum.kirupa.com/t/vector-t-and-interfaces/285632 "2009-04-03T08:40:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EViL\_Bites](https://avatars.discourse-cdn.com/v4/letter/e/ecccb3/32.png) [@EViL\_Bites](https://forum.kirupa.com/u/EViL_Bites)\
**Post date:** [April 3, 2009, 8:40am UTC](https://forum.kirupa.com/t/vector-t-and-interfaces/285632/1 "2009-04-03T08:40:04Z")

</div>

Hi

Just a quick question is it possible to store multiple varying objects that all implement a single specific interface in a a Vector?

For instance

```php
public interface IType 
{
    ...
}

```

```php
public class TypeA implements IType 
{
    ...
}

```

```php
public class TypeB implements IType 
{
    ...
}

```

Which of these two cases would work if at all?

[SIZE=“3”][COLOR=“RoyalBlue”]CASE 1:[/COLOR][/SIZE]

```php
...
var typeA:IType = new TypeA ();
var typeB:IType = new TypeB ();

var objectList:Vector.<IType> = new Vector.<IType> ();

objectList.push (typeA);
objectList.push (typeB);
...

```

[SIZE=“3”][COLOR=“RoyalBlue”]CASE 2:[/COLOR][/SIZE]

```php
...
var typeA:TypeA = new TypeA ();
var typeB:TypeB = new TypeB ();

var objectList:Vector.<IType> = new Vector.<IType> ();

objectList.push (typeA);
objectList.push (typeB);
...

```

Thanks in advance to anyone who can help.
