473,625 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

abstract destructor

Hello!!
Is it possible to have abstract destructor.

//Tony
Jul 23 '05 #1
5 1727
Tony Johansson wrote:
Hello!!
Is it possible to have abstract destructor.


Yes.

Jul 23 '05 #2
Is it possible to have abstract destructor.


Yes.

When should an abstract destructor be used.

//Tony
Jul 23 '05 #3
Tony Johansson wrote:
When should an abstract destructor be used.


Please read the FAQ. It's in there.

Kristo

Jul 23 '05 #4
Tony Johansson wrote:
Is it possible to have abstract destructor.


Yes.


When should an abstract destructor be used.


Let me point out that there is no term "abstract destructor". You can
have a virtual destructor declared pure (just like any other virtual
function), which would make your /class/ abstract. The destructor is
still just 'pure' in that case.

Assuming the conversation is about a pure virtual destructor, the answer
is: when you have no other virtual member functions you want to declare
pure, and you still want your class to be abstract.

V
Jul 23 '05 #5
In article <My************ *******@newsb.t elia.net>,
jo************* ****@telia.com says...
Hello!!
Is it possible to have abstract destructor.


Hopefully you really mean virtual destructor. In that case, the
answer is yes. A virtual destructor is necessary if you might ever
delete an instance of a derived class via a pointer or reference to
the base class.

Alternatively, you might mean a pure virtual destructor, which would
make this an abstract base class. In that case the answer is still
yes. The same condition as above applies here as well, but in this
case (is with any other pure virtual function) the function must be
overridden in some derived class for objects to be instantiated. IOW,
just like any other Abstract Base Class, this one can't be
instantiated itself -- it just defines an interface that will be
supported by derived classes.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 23 '05 #6

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

Similar topics

16
3513
by: Merlin | last post by:
Hi Been reading the GOF book and started to make the distinction between Class and Interface inheritance. One question though: Do pure abstract classes have representations? (data members?) What about abstract classes? Should abstract classes have a destructor and or constructor? What about pure abstract classes?
3
1737
by: pmatos | last post by:
Hi all, I'm having a design problem. Imagine a Shape class that can be a Square, a Rectangle or a Triangle. Shape should be an abstract class. Now, I want to create a stack of Shapes. I do stack<Shape> shapeStack; For some reason (probably because Shape is abstract) this is not working, it results in a compile time error. How can I solve this
8
2574
by: Pete C | last post by:
In this section of the FAQ: http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.10 an abstract destructor is given a definition with the cryptic comment "It's faster this way, trust me". Why? Is it faster to type? I notice that the derived classes in that example seem mysteriously not to require a destructor.
22
2390
by: ypjofficial | last post by:
Hello All, I have following doubt.. class abstractclass { public: abstractclass(){} virtual void method()=0; };
6
1727
by: romayankin | last post by:
Can someone explain what am I doing wrong? Header: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class CMyBase { private: CMyBase(const CMyBase& obj); /* Disable copy constuctor */ void operator=(const CMyBase& obj); /* Disable assignment operator */ protected:
6
3131
by: Alden Pierre | last post by:
Hello, http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7 As per the link above it's wise to have a virtual deconstructor when creating an abstract class. Here is when I'm little confused. Am I deleting the right object when I call the virtual deconstructor? I was under impression when creating a class if I'm not specifically allocating memory, do not implement deconstructor and let the default take care of it...
14
1642
by: junw2000 | last post by:
Is it possible to create an abstract base class without a pure virtual function? Thanks Jack
4
1860
by: Eric | last post by:
I was wondering what people thought about the information found at: http://g.oswego.edu/dl/mood/C++AsIDL.html Specifically, I am interested in the following recommendation: ---- Since interface classes cannot be directly instantiated, yet serve as virtual base classes for implementations, the constructors should take no arguments and should be listed as protected. Also, for similar
17
3526
by: Jess | last post by:
Hello, If I have a class that has virtual but non-pure declarations, like class A{ virtual void f(); }; Then is A still an abstract class? Do I have to have "virtual void f() = 0;" instead? I think declaring a function as "=0" is the same
0
8189
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,...
0
8635
jinu1996
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...
1
8354
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,...
0
8497
tracyyun
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...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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();...
1
2621
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
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
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...

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.