Принудительный доступ к классу только через ребенка - PullRequest
0 голосов
/ 07 апреля 2020

Я хочу принудительно получить доступ к классу только через его дочерний класс.

Представьте себе первый класс как:

//Parent class
public class A
{
    //blah blah
}

и второй класс как:

//Inherited from "A"
public class B : A
{
    //some more blah blah
}

и в третьем классе:

public class C
{
    //To minimize the confusion for some reasons I don't want the  
    //rest of the programming team to be able to access  
    //the "A" class as if a class named "A" doesn't exist.
    //so the following variable should return
    //<type or namespace could not be found> error! or something similar
    private A the_A_Class;
    //Instead I want them to be able to access
    //the "B" class which is a child of "A" class.
    private B the_B_Class;
}

пожалуйста, дайте мне знать, если я должен уточнить это и
заранее спасибо ?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...