When should you use Abstract Class vs Interface while
programming? Give 1 Example
Answer Posted / pravin shrirao
Interfaces are used when we want classes should follow the
rules strictly. Rules like naming coventions e.g. if in
customer class one developer add method AddCustomer other
developer while implementing Invoice class could write
method name InvoiceAdd and also could change the Signiture
rules. for addition of customer we have at client code as
Cutomer.AddCustomer(A,B,C); and Invoice.InvoiceAdd(A,B)
To maintain uniformality if we declare interface and define
method Add(A,B) in that interface and implement that
interface in both the classes then the code will be uniform
all over the classes where ever we have implemented
interface and also all concrete classes must contain
methods which are defined in the interfaces.
| Is This Answer Correct ? | 22 Yes | 5 No |
Post New Answer View All Answers
What is difference between Desktop, Client Server & Web based applications?
Define dma? : Dot net architecture
What is Com Callable wrapper?when it will created?
What is the cli? Is it the same as the clr?
Explain about clr?
Explain about common language infrastructure?
What is Opf3
Name some changes done since version 3.0?
What is a managed code is dim fs as filestreamobject is a managed code? : .NET Architecture
Define cache coherency and how is it eliminated? : Dot net architecture
Explain difference between machine config vs. Web config : Dot net architecture
What is .net mobile utility controls. Explain with an example? : Microsoft dot net mobile
What is .net mobile input validation. : Microsoft dot net mobile
What are the different pipelining hazards? : Dot net architecture
Explain about developer benefit from memory management?