The best way to create instances of an enemy class

I have studied object oriented programming and unity in general for a while now. However I’m still not sure how to accomplish the following:

Say I make a base character class that contains all the attributes shared by both players and enemies (strength, dex, intelligence etc.) and I want to create unique instances of this class and attach those instances to game objects. These instances could in turn be used by other scripts that control combat etc. It’s vital that the instances have differing values on the attributes contained in the base character class. What is the best way to create instances like that?

I couldn’t work out how to do this so I just made two separate scripts that basically did exactly the same thing and attached those scripts to the player and enemy game objects. Very bad coding practice, I know, but I’m not sure how to use inheritance etc. as surely the script would have to inherit from monobehaviour if I am going to attach it to an object?

@bunny83 addressed this a while ago, please read: Inheriting from a class that inherits from monobehaviour - Unity Answers

I think you just want to be inheriting like so C#

public class BaseClass : MonoBehaviour
{
    public int health;
}

so that’s the class the both the player and enemy can/will share, let’s say now you want to create the player script

public class Player : BaseClass
{
    void Start()
    {
         Debug.Log("Health: " + health);
    }
}

now your player has health because BaseClass has it too