};
main()
{
computers comp;
comp.showResults(); // results based on constructor settings
comp.compSpects(3,2,100.5);
cout << "results based on setting"<<endl;
cout << " getprice is "<< comp.getPrice()<< endl;
comp.showResults(); // results based on compSpects settig
Thank you for your response, but servers is a derived class. It is derived from computers class. price is protected member of computers class. I thought that I could access protected members of the base class from derived class.
Yes, you can, and you do. The thing is that each object has its own copy of the variables, so if comp.price is set to 100.5 that will not affect the value of inhComp.price.