Is it possible to implement an interface to a structure? Is
it possible to extend a struct? Is it possible to inherit a
class to struct?
Answers were Sorted based on User's Feedback
Answer / sukriya
Is it possible to implement an interface to a structure?
Ans: A struct can implement interfaces, and it does that
exactly as classes do.
Is it possible to extend a struct?
Ans: struct cannot extend another struct
Is it possible to inherit a class to struct?
Ans: A struct cannot inherit from another struct or class,
| Is This Answer Correct ? | 38 Yes | 2 No |
Answer / mangesh
Yes!! It is definately possible to implement interface to
structure.
struct structure_name: interface_name
{}
Structure cannot be extended.
Class cannot be inherited to structure
| Is This Answer Correct ? | 15 Yes | 3 No |
Answer / niraj sankar
yes!! a class or structure can implement from an interface
in C#.
| Is This Answer Correct ? | 14 Yes | 4 No |
Answer / sushil badyal
yes, We can implement interface in structure.
We can't extend structure also we can't inherit a class to
struct.
| Is This Answer Correct ? | 9 Yes | 2 No |
Answer / jay
just as a sum up for people that might get confused since
some obviously wrong answers are marked as YES:
answers #4,#5 and #6 are correct, 1,2,3 are wrong.
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / bablu
A struct type can implement an interface ya we can do that but the thing is we have to understand that struct is a value type and interface is a reference type data type so it is boxed.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / rafi
it is not possible to implement interface to structure
| Is This Answer Correct ? | 13 Yes | 20 No |
Answer / mukesh kumar
it is not possible to implement interface to structure as
interface does not support inheritance and structure ia
also value type.
| Is This Answer Correct ? | 3 Yes | 21 No |
If a.equals(b) is true then a.gethashcode & b.gethashcode must always return same hash code.
What's the difference between System.String and System..StringBuilder in C#?
What is the difference between continue and break statement?
How is lazy loading achieved?
How many types of delegates are there in c#?
Can you prevent your class from being inherited and becoming a base class for some other classes?
Can we override main method in c#?
What are escape sequences explain with example?
What are custom exceptions in C#?
What are c# i/o classes?
Did a generic class can be inherited by a normal class?
How do I create multifile assembly?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)