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 1 1339
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 advance
Zunbeltz
|
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. Ideally I would
like to call the method using syntax such as:
object.base.method()
The idea is to use an object ('base') to provide the base classes
properties and proxy methods to the real methods stored in '_class' -
see the function below....
|
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 real-time
applications. The majority of expert/people recommend Ada for safety
critical real-time applications. I've many years of experience in C/C++ (and
Delphi) but no Ada knowledge.
May I ask if it is too difficult to move from C/C++ to Ada?...
|
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 thrown in the
1st thread should inherit from, which has 3 virtual functions (clone,
which appears to be pretty standard, raise (just does throw *this), and
another), which are all utterly trival. However, these 3 trivial
functions have to be...
|
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 block, just in case there might be an exception? i.e. is it ok performance-wise to pepper pieces of code with try..catch..finally blocks that must be robust, in order that cleanup can be done correctly should there be an exception?
| |
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 permissions on a stored
procedure, etc. I use this exception handler in all of my applications and
it can be called as simply as follows
try
...
catch ex as sqlexception
ExceptionHandler(ex, otherData1, otherData2)
|
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 guess I could have some properties
that specify wether to call the methods, but I would like to call them
automatically when they are overridden, how do I do this using reflection?
Class A
{
private void methodX()
|
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 only lists NotImplementedException in the Exceptions section.
(Note that it does mention WebException in the Remarks section, but
who knows if this is always the case for such classes, and thus
perhaps they can't be trusted to always list these, and...
|
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
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |