given the following:
class A : B {}
interface I
{
B TheObject {get;set;}
}
can I do this somehow?
class C : I
{
public A TheObject {get;set;}
}
note the interface has the base class and the implementation has the sub class.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Give this a try
You may need to modify the B setter, depending on your needs. Implementing an interface this way has the following consequences. When dealing with a variable typed as a C you will not be able to access B TheObject. If you need to you will need to declare an I variable and assign it to your C var. Implementing I this way is known as an explicit implementation.
eg