Object-oriented programming (OOP) is a programming language model organized around objects rather than “actions” and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.
What’s different about Abstract class and Interface?
– Abstract class: is a parent class for all the classes of the same nature. (relative Is-a). We can use extends keyword in C#, php, java code
– Interface: is a function that you can add and any class. (relative can do). We can use implements keyword in C#, php, java code.
– Cùng má»™t loại, nhóm chúng ta có thể gom thà nh má»™t abstract class (Quan hệ Is – a)
– Cùng má»™t chức năng, chúng ta có thể gom thà nh má»™t interface (Quan hệ can do)
Xem hình bên dưới,
– Ta có các subclass thuá»™c abstract class Animals and Machines
– Ta có các Interface:Swimable, Runnable và Flyable (nhÆ° ta thấy hai subclass Bolt và MCQueen là hai abstract class khác nhau, nhÆ°ng vẫn có chung interface)
How to used Abstract class and Interface:
Have a nice day!
Zidane
http://learn-tech-tips.blogspot.com/