Object Oriented
Programming
Lecture#9: Abstract Classes and Interfaces
Abstraction
Data Abstraction is the process of hiding certain details and showing only
essential information to the user.
Means displaying what is necessary and encapsulating other details
Abstraction means hiding the implementation details and only showing the
functionality
Abstract Classes
C# allows designing a class that can only be implemented to be used. Such
classes are incomplete and thus cannot be instantiated.
Abstract class can have method that are common for all derived classes
(concrete methods)
And it can have methods that are specific for different classes
Such methods are referred to as abstract methods
Interfaces
An interfaces is completely an abstract class, which can only contain abstract
methods and properties
To access the interface methods, the interface must be "implemented" (kind of
like inherited) by another class.
Why And When To Use Interfaces?
1. To achieve security object (interface).
2. Multiple Inheritance

Lec10.pptx

  • 1.
  • 2.
    Abstraction Data Abstraction isthe process of hiding certain details and showing only essential information to the user. Means displaying what is necessary and encapsulating other details Abstraction means hiding the implementation details and only showing the functionality
  • 3.
    Abstract Classes C# allowsdesigning a class that can only be implemented to be used. Such classes are incomplete and thus cannot be instantiated. Abstract class can have method that are common for all derived classes (concrete methods) And it can have methods that are specific for different classes Such methods are referred to as abstract methods
  • 4.
    Interfaces An interfaces iscompletely an abstract class, which can only contain abstract methods and properties To access the interface methods, the interface must be "implemented" (kind of like inherited) by another class. Why And When To Use Interfaces? 1. To achieve security object (interface). 2. Multiple Inheritance

Editor's Notes

  • #3 WriteLine Example
  • #4 WriteLine Example
  • #5 WriteLine Example