• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
8   abstract classes and interfaces
 

8 abstract classes and interfaces

on

  • 1,849 views

 

Statistics

Views

Total Views
1,849
Views on SlideShare
1,849
Embed Views
0

Actions

Likes
0
Downloads
48
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    8   abstract classes and interfaces 8 abstract classes and interfaces Presentation Transcript

    • Abstract classes & Interfaces Programming in C# tnngo2@gmail.com
    • Abstract Classes
    • Abstract Classes referred to as an incomplete base class cannot be instantiated, can only be sub-classed.
    • Implementation The subclass inheriting the abstract class has to override and implement the abstract methods https://gist.github.com/2373593
    • Inheritance
    • Purpose A subclass in C# cannot inherit two or more base class.
    • Interfaces contains only abstract members cannot implement any methods cannot be instantiated by default, all members have public as the access modifier cannot contain constants, data fields, constructors, destructor and static members
    • Implemetation https://gist.github.com/e63d1cf32b03cd888686
    • Mutiple Inheritance https://gist.github.com/7856dad9ccfe58aaa0da
    • Interface Inheritance An interface can inherit multiple interfaces but cannot implement them. https://gist.github.com/2374963
    • What difference between abstract classes & Interfaces?
    • Short Interface: contract only, no implementation, no instantiation Abstract class: contract, some implementation, no instantiation Interface specifying what the object can do Abstract specify what an object is
    • Similarities cannot be instantiated are implemented by the inheriting subclass can inherit multiple interfaces
    • Differences
    • Some stories
    • Recommendations
    • Multiple version of component => Abstract classfunctionality will be useful across a wide range of disparate objects => Interfacessmall, concise function bits of functionality => Interfacescommon, implemented functionality among all implementations ofyour component => Abstract class