123 reputation
5
bio website
location Los Angeles, CA
age 26
visits member for 3 years, 1 month
seen yesterday

Software Engineer at Google.


Sep
24
awarded  Autobiographer
Feb
12
awarded  Popular Question
Feb
15
comment implicit vs explicit interfaces
What about a situation where you have a class Q that uses some class. Q takes a template parameter, so any class that provides the implicit interface will do, or so we think. It turns out that class Q also expects its internal class (call it H) to use Q's interface. For instance, when the H object is destructed, it should call some function of Q's. This cannot be specified in an implicit interface. Thus, templates fail. More clearly put, a tightly coupled set of classes that requires more than just implicit interfaces from each other seems to debar the use of templates.
Feb
10
awarded  Supporter
Feb
10
awarded  Scholar
Feb
10
accepted implicit vs explicit interfaces
Feb
10
comment implicit vs explicit interfaces
Regarding your first pro for compiletime, this is related to one of my main questions. Would you ever want to make it clear that you only want to work with an explicit interface. Ie. 'I don't care if you have all the functions I require, if you don't inherit from Class Z then I want nothing to do with you'. Also, run-time inheritance does not lose type info when using pointers/references, correct?
Feb
10
comment implicit vs explicit interfaces
There are some problems which can be solved by either having a Class or function that takes a pointer to an abstract Class (which provides an explicit interface), or by having a templated Class or function that uses an object that provides an implicit interface. Both solutions work. When would you want to use the first solution? The second?
Feb
10
revised implicit vs explicit interfaces
Added a tag.
Feb
10
awarded  Student
Feb
10
asked implicit vs explicit interfaces