#include <iostream>

using std::cout;

class vehicle {
private: int _nwheels;
public:
	vehicle(int nwheels) : _nwheels(nwheels) { }
};

class mechanism {
private: bool _is_started;
public:
	mechanism(bool is_started) : _is_started(is_started) { }
	void start() { _is_started = true; }
	void stop() { _is_started = false; }
};

class IDrivable {
public:
	virtual void navigate_to(const char *destination) = 0;
	virtual ~IDrivable() { }
};

class car : public vehicle, protected mechanism, public IDrivable {
private: bool _is_hybrid;
public:
	car(int nwheels, bool is_hybrid)
		: vehicle(nwheels), mechanism(false), _is_hybrid(is_hybrid) {
	}
	void navigate_to(const char *destination) {
		cout << "Driving to " << destination << "\n";
	}
};

int main() {
	car *ptruck = new car(6, false);

	// gdb reports the following object's layout in memory:
	//
	// *ptruck {
	//     <vehicle> = {
	//     	   _nwheels = 6
	//     },
	//     <mechanism> = {
	//         _is_started = false
	//     },
	//     <IDrivable> = {
	//     		_vptr.IDrivable = 0x80489e0
	//     }, 
	//     _is_hybrid = false
	// }

	delete ptruck;

	return 0;
}
