Пример #1
0
int main () {

InputDevice* scanner = new InputDevice("Scanner");
cout << scanner->getName();

Device* printScanDev = new IODevice("PrintScan");
printScanDev->connectToCPU();

return 0;
}
Пример #2
0
// get device name
static std::string getDeviceName(int id)
{
	std::map<int, std::string>::const_iterator search = g_device.find(id);
	if (search != g_device.end())
	{
		return search->second;
	}

	InputDevice device = InputDevice::getDevice(id);
	std::string name = device.getName();
	g_device[id] = name;

	return name;
}