-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Nitin Mekhiya
Message 3 in Discussion

Abstract Class v/s Interface 

Lets take N-Tier scenario wherien you have got Server layer and then Client 
layer on top of it.

Abstract Class has Server side reusability.Interface has Client side 
reusability. 

Interface acts as a Contract, which when implemented by some Class,assures that 
the Services offered by interface will be implemented by the Class.This helps 
at the Client end.
 
Lets take an eg: - Client Interacts with somewhat common Class 
Car,Bike,Truck.now instaed of binding all classes to Client. We make an 
interface Called vehicle.Client is Binded to Interface .We enforce CAR , Truck 
and Bike to implement Interface vehicle. 
As a result Client does not need to have knowledge of Car truck etc...It just 
has to interact with Vehicle.

Thus we have made CLient independent of different objects comein.thats what we 
call Client Reusability.(Not to change client code , if tomorw some new Object 
comes in to picture.) 



Abstract Class. 
this has got more to do with Server side reusability.Which simply means that 
suppose I have Class BinarySort,HeapSort.Both of them have attributes - count 
and operations - GetStatus()common. 

So try to get these common things in to Parent.When Child inherits the Parent 
It gets the Features from parent. 

Now if we dont want someone to call method of parent , then we need to make it 
abstract.And once you make any method of parent abstartc , you need to make all 
the methods abstarct and , whole class to abstract. 

Now you can not make instance of abstarct class.Its usage is only to get 
Inherit by child class. 
This is as good as InterFACE.eNFORCING sERVICE TO cHILD cLASS, without any code 
implementation or attribute derivation. 

We can also say Abstract Class is specific case of interface.




-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to