Should i inherit my classes from Sprite class?

I 'm trying to make a Mastermind game(I think all of you are familiar with it) using MG.extended.
For start i have two class : “Piece” and “Hole” (i want drag pieces to holes with mouse )and i want them to be inherited from Sprite class with one different: texture should be load without passing to constructor as an argument. But when i try to make 0 argument constructor for “Hole” or “Piece” i get this error (“Sprite doesn’t have a constructor with zero argument”).
-So how can i load texture for my inherited class (from Sprite) without passing it to constructor?
Can i make a zero argument constructor for my class?
Or maybe i should inherit from another class?

I hope it is clear.

These are just some thoughts:

you can make a list of textures, populate it with all your texture2d’s, and then pass the index number for whatever texture to use… But then, you are still passing something…

or you could edit each instance after it is created, like holes_list[0].texture = whatever;
(you could do this in a for-loop)

Or you can edit the sprite class to include a constructor that takes whatever overloads…

1 Like

thank you @monopalle you helped me.
I think I solved it or just find a workaround for’s working anyway.
here my “Hole” class

 namespace MasterMind
    class Hole : Sprite
   // first constructor. routine
    public Hole(Texture2D texture2d)
        : base(texture2d)

    // my Constructor
    public Hole (ContentManager content) 
        : base(content.Load<Texture2D>("hole"))


the first constructor is routine Sprite constructor. but in the second one I passed a Contentmanager
and also pass it to base Sprite constructor.
now in the Game class is simply like this

myhole = new Hole(Content);

Now every time i need a Hole just need the Content manager and not texture.