why is only my first class working? when i run this it just asks about the viruses and not the cost of the OS.
#include <iostream>
using namespace std;
class OperatingSystem
{
private:
float cost;
public:
OperatingSystem() : cost(0) {}
float getCost() { return cost; }
void setCost(float cost) { OperatingSystem::cost = cost; }
void inputInfo();
void outputInfo();
};
class Windows : public OperatingSystem
{
private:
unsigned long numberofviruses;
public:
Windows() : OperatingSystem(), numberofviruses(0) {}
unsigned long getNumberofviruses() { return numberofviruses; }
void setNumberofviruses(unsigned long numberofviruses)
{ Windows::numberofviruses = numberofviruses; }
void inputInfo();
void outputInfo();
};
int main()
{
Windows variable1;
variable1.inputInfo();
variable1.outputInfo();
return(0);
}
void Windows::inputInfo()
{
unsigned long temp;
cout << "Enter the number of viruses Windows currently has: ";
cin >> temp;
setNumberofviruses(temp);
}
void Windows::outputInfo()
{
cout << "Windows current has " << getNumberofviruses()
<< " known viruses." << endl;
}
void OperatingSystem::inputInfo()
{
float temp;
cout << "Enter the cost of the Operating System: ";
cin >> temp;
setCost(temp);
}
void OperatingSystem::outputInfo()
{
cout << "Your Operating System cost $" << getCost() << endl;
}