MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / CreateCar

Function CreateCar

12.10-constexprAllocation0/main.cpp:21–30  ·  view source on GitHub ↗

#C A factory function to create a car

Source from the content-addressed store, hash-verified

19
20// #C A factory function to create a car
21Car* CreateCar(int i)
22{
23 switch(i) {
24 case 0: return new Mercedes{};
25 case 1: return new Toyota{};
26 case 2: return new Tesla{};
27 }
28
29 return nullptr;
30}
31
32int FastestCar()
33{

Callers 2

FastestCarFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected