GetComponent on an Extended class ?

I have in my game several kinds of projectiles. Each have its own script to define its behaviour.

Each projectile script extends from a Single “Projectile” class.

For example, for the arrow projectile :
(I attach this script to the Arrow prefab.)

class Arrow extends Projectile extends MonoBehaviour{
    function Initialize(a,b,c){
    [...]
    }
}

Then, I have the Projectile class : (it is empty)

class Projectile{
}

Each tower in my game has a Firing script attached. In these scripts, I want to be able to use :

var projectileInstance = Instantiate(projectile,pos,rot);
projectileInstance.GetComponent.<Projectile>().Initialize(a,b,c);

However I receive the following error :
BCE0019: ‘Initialize’ is not a member of ‘Projectile’.

Can you help me figuring out what is wrong here ? Any help is welcome.

You can’t extend multiple in the same script, same with c#, you will have to create a stack of class inheritance in order to do what you need. Or you could use interfaces… perhaps something like below, completely untested.

interface IProjectile{
	function Initialize(a, b, c);
}
 
class Arrow extends MonoBehaviour implements IProjectile {
	function Initialize(a, b, c){
		// do some business
	}
}

var projectileInstance = Instantiate(projectile,pos,rot);
projectileInstance.GetComponent.<Projectile>().Initialize(a,b,c);

if this works like c# then anything implementing the interface should have no issues with the contract that interface explicitly says exists on any type that has implemented it. This allows you to call multiple objects that use the same interface(contract) without knowing all the crap about the full class implementation and invoke methods that are in the interface.