cantnot create instance of abstract class

hey not sure if I’m doing this right, but I’m trying to make an inventory system where if you pickup something i retrieve some data from the object into my inventory.
don’t get the error because I’m not using an abstract class, but clearly I’m doing something wrong.

in the inventory script

static var ItemList:List.<Items>;

static class Items
{
	var name:String;
	var type:String;
	function Items (name:String, type:String)
	{
		name=this.name;
		type=this.type;
	}
}

in the pick up script

if(hit.collider.tag=="collectable")
		{
			collect=true;
			hitObj=hit.collider.gameObject;
			if(Input.GetKeyDown(actionKey))
			{
				inventorySystem.ItemList.Add(new Items(hitObj.name,hitObj.name));
			}
		}

In the inventory script, change

function Items (name:String, type:String)

to

function AddItem (name:String, type:String)

In the pick up script, change

inventorySystem.ItemList.Add(new Items(hitObj.name,hitObj.name))

to

inventorySystem.ItemList.Add(new Items.AddItem(hitObj.name,hitObj.name))

hey thanks for the reply, makes sense. although i have other scripts where the class and function have the same name and work…?
anyway console coughs up this error: Assets/jethro/pickUp.js(21,61): BCE0017: The best overload for the method ‘System.Collections.Generic.List..Add(Items)’ is not compatible with the argument list ‘(void)’.

can’t seem to shake this error :frowning: any ideas?
i don’t get why it says the overload is empty (or at least thats what i make of it)

these are the full scripts:

inventorySystem:

#pragma strict
import System.Collections.Generic;

var windowRect: Rect;
private var inventoryWinHeight: int;
private var inventoryWinWidth: int;
private var DisInventory=false;
static var ItemList:List.<Items>;

static class Items
{
	var name:String;
	var type:String;
	function AddItem (item:GameObject)
	{
		name=item.name;
		type=item.name;
	}
}
function Inventory () 
{
	if (GUILayout.Button("close Inventory"))DisInventory=false;
}

function OnGUI () 
{
	if(!DisInventory)
	{
		if(GUI.Button(Rect(Screen.width-90, Screen.height -35, 75, 20), "Inventory"))
		{
			DisInventory=true;
		}
	}
	if(DisInventory)
	{	
		inventoryWinWidth = Screen.width/3;
		inventoryWinHeight = Screen.height/3; 
		windowRect= new Rect ((Screen.width/2)-(inventoryWinWidth),(Screen.height/2)-(inventoryWinHeight),inventoryWinWidth*2,inventoryWinHeight*2);
		windowRect=GUILayout.Window (0, windowRect, Inventory, "Inventory");
	}
}

pickUp script:

#pragma strict
import System.Collections.Generic;

var actionKey: KeyCode;
var rayLenght: int;
private var collect=false;
private var hitObj:GameObject;

function Update () 
{
	var ray = new Ray (transform.position, transform.forward);
	var hit: RaycastHit;
	if(Physics.Raycast(ray, hit, rayLenght))
	{
		if(hit.collider.tag=="collectable")
		{
			collect=true;
			hitObj=hit.collider.gameObject;
			if(Input.GetKeyDown(actionKey))
			{
				inventorySystem.ItemList.Add(new Items.AddItem(hitObj));
			}
		}
	}
	else
	{
		collect=false;
	}
	
}
function OnGUI()
{
	if(collect)
	{
		GUI.Label(Rect(Screen.width/2-75, Screen.height/2-15, 150,30),GUIContent("press "+actionKey.ToString()+ " to collect"));
	}
}