How to override a virtual method in non inherited script

I’m trying to override a function but I keep get error that no suitable methods to override

Script A

[Createassetsmenu(filename = "weapon"), menuname("item/weapon")]
Public class Weaponclass : scriptableobject
{

New public string name = " newname";
Public sprite Icon = null;
Public GameObject weaponmodel = null;






Public Virtual void Shoot()

{
}

}

Script B

Public class Ak47 : monobehaviour {

Public Weaponclass myweapon


Public override void Shoot ()
{
Debug.Log("shooting " + myweapon.name);
}

}

As you seen above in script B the shoot() Function give error that no suitable shoot method to override which I have already declared the weapon that contain the virtual Function;
Any help thanks!.

}

Because your Ak47 class needs to inherit from Weaponclass,
right now it inherits from MonoBehaviour which has no virtual shoot method.

You should know that since, you are inheriting Weaponclass from ScriptableObject, if you also inherit Weaponclass on Ak47 class it won’t be a MonoBehaviour but in turn a ScriptableObject aswel.