Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Base Classe Inheritance #11704


User avatar
0
[email protected] created

I was hoping someone would be able to offer some assistance with having base classes in AspNetZero. AspNetZero Version: latest Tech Stack: Asp .Net Core w\ MVC & jQuery

I need to have a base class “Animal” which will contain properties that are relevant to ALL species of animals. An example would be that I have a “PIGS” entity which must inherit from “AnimalBase”.

I’m not too sure how to accomplish this in AspNetZero. I would greatly appreciate a “dumbed-down” response. I have a learning disability which doesn’t make things impossible just takes me longer to catch on.

Thanks


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do this as you can do it in a regular C# application. Here is a very simple example.

    public class AnimalBase{
        public int Age {get; set;}
    }
    
    public class Pigs : AnimalBase {
        // other properties...
    }
    

    I hope this helps.