2

I have a class with protected constructor. Is there any possibilities to access this class from another class

Base Class :

    public class BaseClass
    {
    private static ClassA _classA = new ClassA();
    private static ClassB _classB= new ClassB();
    protected BaseClass(ClassA _classA, ClassB _classB)
    {
        _classA = classA;
        _classB= classB;
    }

This is my Derived Class :

    public class DerivedClass : BaseClass
    {

    }

Derived class require to pass parameter. How to solve it.

Dineshkumar P
  • 81
  • 1
  • 12
  • 2
    Possible duplicate of [Passing parameters to the base class constructor](https://stackoverflow.com/questions/23481456/passing-parameters-to-the-base-class-constructor) – mjwills Jan 25 '19 at 11:57
  • 1
    Are you sure your `BaseClass` looks like that? It is **very** odd to have an instance constructor that overwrites `static` variables like that. – mjwills Jan 25 '19 at 11:58

1 Answers1

2
public class DerivedClass : BaseClass
{
    public DerivedClass(ClassA classA, ClassB classB) : base(classA, classB)
    {

    }
}
Sergey Anisimov
  • 885
  • 8
  • 22