Class Inheritence question

If i have a classes and then another class using inheritance from the first one. when i do file handling to the class (put data from .txt file to class) does the inheritance change as well?
Hi zone19871,

I am not quite sure what you mean, could you elaborate?

If you have a class A, for example, possessing a member function A::read(std::ifstream&,...) that reads data from a text file (that you pass as an ifstream object, e.g., ifstream infile("data.txt"), to A::read), and a derived class B that inherits (publicly, say) form A, then objects of class B will contain the member function A::read as well. So if you instantiate an object of class A or B, you can still read data into either of them using A::read.

The inheritance relationship between A and B is not effected by the way you define A::read.

Hope this helps.
Topic archived. No new replies allowed.