java - Android: A PendingIntent is a form of an Intent, then why isn't PendingIntent a subclass of Intent? -
they
generally, when there exists "is-a" relationship between 2 entities, there inheritance relationship in terms of oop.
for illustration
"a mount bike bicycle."
so mountainbike
subclass of bicycle
well, mountainbike
inherits properties of bicycle
, , has of own well.
now, speaking pendingintent intent, isn't it? why pendingintent subclass of intent?
reference: developer docs
generally speaking pendingintent intent, isn't it?
a pendingintent
can best thought of wrapper around intent
, identifying operation performed (start activity, start service, send broadcast) , security context under operation should performed.
hence, "has-a" relationship model reasonable approach here.
java android inheritance android-intent android-pendingintent
No comments:
Post a Comment