Create Descendant
- 2 minutes to read
In This Article
Creates a descendant class, providing implementation stubs for abstract members of a base class. Selects the contents of the last generated descendant member and drops the marker onto the base class declaration.
#Availability
From the context menus or via shortcuts:
- when the edit cursor or caret is on a class name within its declaration.
#Notes
If a base class contains abstract members, their implementation stubs will be added to a descendant class.
#Example
abstract class │TestClass
{
public int Doubler(int param)
{
return param*2;
}
public virtual string GetCaption()
{
return "Caption";
}
public abstract int Multiply(int param);
}
Public MustInherit Class │TestClass
Public Function Doubler(ByVal param As Integer) As Integer
Return param * 2
End Function
Public Overridable Function GetCaption() As String
Return "Caption"
End Function
Public MustOverride Function Multiply(ByVal param As Integer) As Integer
End Class
Result:
internal class TestClassDescendant : TestClass
{
public TestClassDescendant()
{
throw new NotImplementedException();
}
public override int Multiply(int param)
{│throw new NotImplementedException();
}
}
abstract class TestClass
{
public int Doubler(int param)
{
return param*2;
}
public virtual string GetCaption()
{
return "Caption";
}
public abstract int Multiply(int param);
}
Public Class TestClassDescendant
Inherits TestClass
Public Sub New()
Throw New NotImplementedException()
End Sub
Public Overrides Function Multiply(ByVal param As Integer) As Integer│Throw New NotImplementedException()
End Function
End Class
Public MustInherit Class TestClass
Public Function Doubler(ByVal param As Integer) As Integer
Return param * 2
End Function
Public Overridable Function GetCaption() As String
Return "Caption"
End Function
Public MustOverride Function Multiply(ByVal param As Integer) As Integer
End Class