B
B
Bosicom2018-03-31 18:45:11
C++ / C#
Bosicom, 2018-03-31 18:45:11

How to make a class heir?

It is not possible to make a class heir:

// Сводка:
//     Provides the APIs for managing user in a persistence store.
//
// Параметры типа:
//   TUser:
//     The type encapsulating a user.
public class UserManager<TUser> : IDisposable where TUser : class
{
}

What am I doing wrong?
public class UserManagerWrapper<TUser> : UserManager<TUser>
{

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Silin, 2018-04-01
@byme

public class UserManager<TUser> : IDisposable 
    where TUser : class
{
   public void Dispose()
   {
      throw new NotImplementedException();
   }
}

public class UserManagerWrapper<TUser> : UserManager<TUser> 
    where TUser : class
{

}

Inheriting from UserManager, the new TUser (from UserManagerWrapper) must fulfill the same conditions as the TUser inside the UserManager

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question