Gibt es eine Methode zur Verwendung von base.base in einer Override-Methode? [Duplikat]C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Gibt es eine Methode zur Verwendung von base.base in einer Override-Methode? [Duplikat]

Post by Anonymous »

Das ist vielleicht eine schlechte Praxis, aber ich würde trotzdem gerne wissen, ob es möglich ist.

Code: Select all

public class BaseClass
{
protected virtual void createArrays(int vertexCount)
{
// do the actual work
}
}

public class A : BaseClass
{
protected override void createArrays(int vertexCount)
{
// Do something specific to A
base.createArrays(vertexCount);
}
}

public class B : A
{
protected override void createArrays(int vertexCount)
{
//Do something specific to B, but not to A
base.base.createArrays(vertexCount); // this is the part that doesn't work, I actually want to call the createArrays from the BaseClass
}
}
Es ist wahrscheinlich am besten, sowohl A als auch B von BaseClass zu erben, aber ich würde mich über einige Einblicke freuen

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post