gfactory
Loading...
Searching...
No Matches
TeslaFactory.cc
Go to the documentation of this file.
1#include "TeslaFactory.h"
2
3#include <iostream>
4using namespace std;
5
6// See header for API docs.
7
8void Tesla::go() {
9 cout << " Instantiating Tesla" << endl;
10
11 // Print example state to demonstrate that the object is fully constructed and callable.
12 cout << " Factory car tesla autopilot[0][0] " << autopilot[0][0] << endl;
13 cout << " Factory car tesla autopilot[0][1] " << autopilot[0][1] << endl;
14 cout << " Factory car tesla autopilot[1][0] " << autopilot[1][0] << endl;
15 cout << " Factory car tesla autopilot[1][1] " << autopilot[1][1] << endl;
16
17 // Print inherited base-class state.
18 cout << " generalCarVar is " << generalCarVar << endl;
19}
20
21Tesla::Tesla(const std::shared_ptr<GOptions>& gopts) : Car(gopts) {
22 // Example initialization of Tesla-specific state.
23 autopilot[0][0] = 0;
24 autopilot[0][1] = 1;
25 autopilot[1][0] = 10;
26 autopilot[1][1] = 11;
27}
Example base class used to demonstrate dynamic factory loading.
Definition Car.h:22
double generalCarVar
Example data member shared by all derived cars.
Definition Car.h:57
Tesla(const std::shared_ptr< GOptions > &gopts)
Construct and initialize the Tesla plugin.
void go()
Example behavior for the Tesla plugin.
double autopilot[2][2]
Example Tesla-specific state.