tag:blogger.com,1999:blog-6289695796997559266.post3423262325596526872..comments2022-03-18T05:02:51.033-07:00Comments on The C++ blog: The importance of Interface classes100rabh™http://www.blogger.com/profile/08213344486463590285noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6289695796997559266.post-17002170932037348542009-10-15T03:49:51.980-07:002009-10-15T03:49:51.980-07:00Yeah you are right, example is probably not meant ...Yeah you are right, example is probably not meant as an example of creating interfaces, but I just wanted to convey the use of Interface classes.<br /><br />Glad you noticed :-)<br /><br />Actualy implimentation should actually be something like this <br />class Time: public ITime<br />{<br /> public : int getHour(){return m_hour;}<br /> int getMinute(){return m_min;}<br /> int getSecond(){return m_sec;}<br /> void setHour(int hour){m_hour = hour;}<br /> void setMinute(int min){m_min = min;}<br /> void setSecond(int sec){ m_sec = sec;}<br /> private: int m_hour, m_min, m_sec;<br />};100rabh™https://www.blogger.com/profile/08213344486463590285noreply@blogger.comtag:blogger.com,1999:blog-6289695796997559266.post-22341561003984309472009-10-15T03:42:58.470-07:002009-10-15T03:42:58.470-07:00Derived class do not have to implement the pure vi...Derived class do not have to implement the pure virtual methods of their parent classes.<br /><br />They can simply make them pure virtual methods again.<br /><br />This is not really a sound contract, whereas with true interfaces, a body of code has to be provided or there is no compilation.st203https://www.blogger.com/profile/08750698579561727384noreply@blogger.com