Sorry for the confusing title. Basically I made a BinaryReader class that reads in big endian and set its constructor up as:
BinaryReader2(System.IO.Stream strm) : base(strm){}
I was told that you can’t call the base class’s constructor any other way, and that this was the best way to do it.
The problem is that when another program has control of a file I’m trying to read, it doesn’t display any error messages (because I’m new to programming and didn’t set up any try catch statements..). So, I’m trying to account for all the possible situations by using try-catch statements. I’ve never used them before, so I was hoping I could get a few pointers on it.
I created the binaryreader2 class in many places throughout the program and was hoping I could set up the try catch inside the binaryreader class itself instead of in each of the places I used it. Is it possible to do that and still call the base class’s constructor?
One possible workaround: Use composition over inheritance. this way you have a better control on initializing the formerly base object.