Question: Virtual Functions . C++ programming 2 using code blocks. Please solve as written and in an easy method . Define the following five classes with
Define the following five classes with public inheritance, they represent five different car accessories Class Car (base) with data members (string model, int price) , Class Safety (inherits Car) with data members (string ABS, int airbags, int cost) and functions (set , print, find Cost), Class Luxury (inherits Safety) data members ( string leather Seats, string GPS) and functions ( set ,print , find Cost ) , Class AI (inherits Luxury) members (char night vision, string selfchecking) and functions (set , print, find Cost) , Class Executive(inherits AI) members ( char fax, conferencing) and functions (set , print, find Cost). int main0 Safety one"Camery", 58000, "EIS5.8",2); Luxury twol"Camery", 58000, "EIS5.8", 2, "Embroidery", "eTrex"); AI three" Camery", 58000, "EIS5.8",2, "Embroidery" "eTrex", N', "Partial"); Executive four Camery", 58000, "EIS5.8", 2, "Embroidery", eTrex, N, "Partial", 'N, Y: Car *ptrCar4]; ptrCarl0]-one; ptCarl1]-&two; ptrCar[2]-&three ptCarl3]-&four for(int i-o i-4; i++) ptCarfil->findCost0: ptCarli- printo: cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
