-1

my problem is to access a members of an abstract super class from nested members (class or struct) of another derived class

for example:

    public abstract class DataAccessLayer {
        public DataAccessLayer(string _connectionString) { //some code }

        //some member functions
    }

another classes will be derived from this class

    public class DataStructureLayer : DataAccessLayer {
         pubic DataStructureLayer(string connectionString) : base(connectionString) { // NOP }

         //Here we have structures or classes
         //we want to access members of a superclass "DataAccessLayer"
         //from these struts
         public struct Books { 
               //members
         }
    {
    }

i want to use the super class members inside the nested structs of the derived one without making an instance from this, is there a way?

1 Answers1

0

In your code you have the DataAccessLayer and the DataStructureLayer. The constructor of DataStructureLayer calls the constructor of DataAccessLayer. So the single problem you still have is that you cannot call the constructor from Books? In that case you can do this:

DataStructureLayer dtl = new DataStructureLayer("yourconnectionstring");
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175