Amazon Interview Question

When would you use an interface, a abstract class, a virtual class.

Interview Answer

Anonymous

Nov 7, 2012

Interface: does not have implementations. Its just a contract between user and provider.So in layman's words it just contains function signature :NO Implementation No data Members Abstract Class:contains one or more virtual function.. Cannot be instantiated, Might have data members and implementation of few functions... made to be inherited Virtual class: can have data,can have implementation of functions... only difference is if inherited twice (thru two paths) the subclass gets only one copy of the data members,hence avoiding ambiquity