Skip to main content

What Is C# Inherit Class

Inherit Class / Derived Class

This is the way that we achieve abstraction. An abstract class is a class that will never be instantiated directly. In order to achieve this, the class must have at least one abstract method and be marked with the abstract keyword within the class definition. In the main purpose of this class, it sets out the rules that must be followed by derived classes when they inherit an abstract class in order to give a blueprint for derived classes. A base class can be derived from an abstract class and the abstract definitions must be implemented by all derived classes.

Create an inherited class.

public class QueryRequest
{
//query
public int? from { get; set; }
public int? size { get; set; }
public int? memberId { get; set; }
public List<Filter> filters { get; set; }
public Sort sort { get; set; }
}

public class QueryRequestWithQ : QueryRequest{
public class QueryRequest
{

//query
public string q { get; set; }
}
}