J
jakash3
I've noticed that in Languages like Java and C#, some classes have
methods named "GetInputStream" and "GetOutputStream" rather than
having the class inherit from a stream class. For example. Instead of
having something like this:
(where File inherits from both InputStream and OutputStream)
You have something like this:
Which design is better?
methods named "GetInputStream" and "GetOutputStream" rather than
having the class inherit from a stream class. For example. Instead of
having something like this:
Code:
File f;
f.open("foo.txt");
f.print("hello world!\n");
f.print("aslkdfj sladkfj sladkf");
f.close();
You have something like this:
Code:
File f;
OutputStream os;
os = f.GetOutputStream();
os.print("hello world!\n");
os.print("asdfj sladkfj sladkf");
f.close();
Which design is better?