473,379 Members | 1,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Exceptions and overridden methods



Hello guys,

I consulted both MSDN and Borland Builder's documentation to try to find
something about this, but I haven't found it. I saw that both VC++ and
Builder support different kinds of exception handling mechanisms. As I
understand, the standard way is to use exception handling through exception
classes and try/catch statements. Now, in Java, it is mandatory to supply
method prototype with info on which exceptions can occur. This seems to be
supported by Borland C++, and looks like a good way to have good, documented
code. Is it the part of ANSI C++ standard? Furthermore, I was in doubt what
to do if I have inherited class and want to override the parent's class
method. If I have method in base class which declares to throw some
exceptions, compiler would complain if exact set of exceptions were not
supplied by overriding method in derived class. I have situation in which I
would like to add some more possible exceptions in overridden method. Is it
possible, and should I really use this method of documenting possible
exceptions in methods?

Thanks in advance,

Milan Gornik


Jul 23 '05 #1
1 1322
Milan Gornik wrote:
Hello guys,

I consulted both MSDN and Borland Builder's documentation to try to find
something about this, but I haven't found it. I saw that both VC++ and
Builder support different kinds of exception handling mechanisms. As I
understand, the standard way is to use exception handling through exception
classes and try/catch statements. Now, in Java, it is mandatory to supply
method prototype with info on which exceptions can occur. This seems to be
supported by Borland C++, and looks like a good way to have good, documented
code.
Don't use them:
http://www.gotw.ca/gotw/082.htm
Is it the part of ANSI C++ standard?
Yes.
Furthermore, I was in doubt what
to do if I have inherited class and want to override the parent's class
method. If I have method in base class which declares to throw some
exceptions, compiler would complain if exact set of exceptions were not
supplied by overriding method in derived class. I have situation in which I
would like to add some more possible exceptions in overridden method. Is it
possible, and should I really use this method of documenting possible
exceptions in methods?


Don't do that:
http://www.objectmentor.com/resource...les/lsp.pdf%20
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Zunbeltz Izaola | last post by:
Hi, I've the following problem with try/exception. I've a try block that will raise some exceptions. I want the program to ignore this exceptions completely. Is it possible? Thanks in...
1
by: Bryan Ray | last post by:
I am trying to write an inheritance function, so I can call a base classes method that has been overridden in the derived class. I want to get rid of the ugly 'call()' syntax that would be used....
822
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical...
2
by: ThosRTanner | last post by:
Having had a look at ways of passing exceptions from one thread to another, whilst trying to keep the "catch by const ref" coding standard alive, I've ended up making a class from which exceptions...
6
by: RepStat | last post by:
I've read that it is best not to use exceptions willy-nilly for stupid purposes as they can be a major performance hit if they are thrown. But is it a performance hit to use a try..catch..finally...
2
by: Eric Sabine | last post by:
I built a generic exception handler form which allows the user to get information from it, print it, email it, etc. for exceptions for which I explicitly didn't handle in code, such as missing...
8
by: Allan Ebdrup | last post by:
I'm writing some code where I have have a class that implements 4 methods (class A) I only want to call these methods from the base class if they have been overridden in a sub class (Class B) I...
2
by: Zytan | last post by:
I know that WebRequest.GetResponse can throw WebException from internet tutorials. However in the MSDN docs: http://msdn2.microsoft.com/en-us/library/system.net.webrequest.getresponse.aspx It...
12
by: Ratko | last post by:
Hi all, I was wondering if something like this is possible. Can a base class somehow know if a certain method has been overridden by the subclass? I appreciate any ideas. Thanks, Ratko
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.