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


Please Help Members By Posting Answers For Below Questions

what are login controls?

1405


Name some changes done since version 3.0?

547


What is WPF and WCF?

569


How to implement the display in the class printdoc (how to resolve the naming conflict) a: no naming conflicts

609


What is cache coherency? : Dot net architecture

484






can u give me real example of how web.config overrides the machine.config file?

1281


12. Types of polymorphisem[Run and Design Exp.]

1644


Explain the types of memory management? : .NET Architecture

511


Explain 'managed' mean in the .NET context

686


Explain dma? : .NET Architecture

534


What is MS chart control in visual studio?

683


What are the different pipelining hazards and how are they eliminated? : Dot net architecture

585


What is private constructor? And it's use?

632


What is an interrupt? : .NET Architecture

467


Explain some of the disadvantages due to microsoft.net?

536