What does implementation inheritance mean in the javadoc of java.sql.Timestamp?

From the JavaDoc of java.sql.Timestamp class(emphasis mine)

Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance.

What does it mean to say implementation inheritance and not type inheritance? Is it a case of HAS-A vs IS-A?

Answers


Basically, the documentation states that the fact that java.sql.Timestamp extends java.util.Date is an implementation detail, and you should not use Timestamp instances where you expect to get Date's functionality. Presumably, if java had the option (like C++ does), Timestamp would privately inherit from Date.


What they mean is that they designed Timestamp as a subclass of Date not to have polymorphism and because a Timestamp is a Date, but because they wanted to easily reuse code from the Date class.


Need Your Help

Ambari - Trouble Checking Status for Custom Application

python hadoop ambari

I've been playing around with creating a custom application inside of our Ambari installation. After a little bit of toying, I've successfully got this configured to do the installation and startup

example of uploading video to facebook in ios 6 using SLRequest (without dialog)

ios facebook video ios6

I am looking for an example where a video is posted to facebook using iOS 6 & SLRequest. I already have my code working for uploading a photo.