How can you declare a technique in C# that needs to be overridden (or overridable) with a dereived class - potentially outdoors your set up - but that needs to be callable only from inside the particular class?

(i.e. just like a private virtual function in C++)

[edit]
private virtual is what I intend: "Here's a method to modify my behavior, but you're still not permitted to refer to this as function directly (because calling it takes arcane invocations that only my base class shall do)"

To clarify it: what's the best expression for your in C#?

Whenever you say it will simply be callable "inside the actual class" would you mean the bottom class or even the derived class? Neither could well be achievable by itself. The nearest is by using a protected method, meaning it may be known as in the proclaiming class, the derived class, and then any further-derived class.

A personal member isn't visible to child classes. I believe protected virtual will work the way in which you would like?

UPDATE:

Within greater detail is definitely an explaination of you skill with inheritance and overriding functions within C#. I attempted to utilize a somewhat significant example, but contemplate it understood that it is an undesirable class design and that i wouldn't ever recommend applying the classes referred to in by doing this. However, I really hope possibly this provides you with a method to approach fixing your original problem in a fashion that may be acceptable. There's not a way to avoid a concrete class from calling some of its people, but when your structure is much like this in anyway, possibly it is not problem.

public abstract class Animal

Title: " + Title())

        Console.WriteLine("Legs: " + Legs())

        Console.WriteLine()

    

    protected virtual int Legs()

    

    private string Header()

    Exhibiting Animal Characteristics"

    

    protected abstract string Title()



public class Bird : Animal

Title()

    

    protected override int Legs()

    



public class Zebra : Animal

Title()

    



public class Seafood : Animal

Title()

    Seafood"

    

    protected override int Legs()

    

    private string Header()

    Exhibiting Seafood Characteristics"

    

    protected virtual int Gils()

    

    public new void DisplayAttributes()

    Title: " + Title())

        Console.WriteLine("Gils: " + Gils())

        Console.WriteLine()

    



class Program

Primary(string[] args)

    Exhibiting Animal Characteristics

        //Title: Bird

        //Legs: 2

        Zebra zebra = new Zebra()

        zebra.DisplayAttributes()

        //Exhibiting Animal Characteristics

        //Title: Zebra

        //Legs: 4

        Seafood seafood = new Seafood()

        seafood.DisplayAttributes()

        //Exhibiting Seafood Characteristics

        //Title: Seafood

        //Gils: 2

        List<Animal> animalCollection = new List<Animal>()

        animalCollection.Add(bird)

        animalCollection.Add(zebra)

        animalCollection.Add(seafood)

        foreach (Animal animal in animalCollection)

        Exhibiting Animal Characteristics

            //Title: Bird

            //Legs: 2

            //Exhibiting Animal Characteristics

            //Title: Zebra

            //Legs: 4

            //Exhibiting Animal Characteristics

            //Title: Seafood

            //Legs:

            //*Note the main difference here

            //Inheritted member cannot override the

            //base class functionality of the non-virtual member

        

    



Within this example, Bird, Zebra, and Seafood could all call their Title and Legs techniques, but inside the context if the example, there wouldn't always be utility by doing this. Furthermore, as proven by Seafood, the DisplayAttributes() could be modified for a clear case of a concrete derived class however when you are searching in an Animal, as with the foreach loop, you receive the bottom classes DisplayAttributes behavior, no matter the particular kind of animal. I really hope this might help povide the kind of functionality you want to replicate.