I m create a class and i m inherit class
public class abc : Manager, Inteface
{
public abc() { string a = context; }
}
When i m inherit class first and interface only then i m able to get context of Manager class.
when i inherit interface first then manager class ,then i m not able to access context of manager class.
public class abc : Inteface,Manager
{
public abc() { string a = context; } // I m not able to access the context of Manager class.
}
That's simply invalid C#, and the compiler should be telling you about it - the class that you're deriving from should appear first in the list.
As an example of the compiler error message you should be getting:
public interface IFoo {}
public class Base {}
public class Derived : IFoo, Base {}
Output:
Test.cs(5,30): error CS1722: Base class 'Base' must come before any interfaces
From the C# 5 specification, section 10.1.4:
A class declaration may include a class-base specification, which defines the direct base class of the class and the interfaces (ยง13) directly implemented by the class.
class-base:
:
class-type
:
interface-type-list
:
class-type,
interface-type-listinterface-type-list:
:
interface-type
:
interface-type-list,
interface-type
See more on this question at Stackoverflow