473,386 Members | 1,830 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,386 software developers and data experts.

abstract destructor

Hello!!
Is it possible to have abstract destructor.

//Tony
Jul 23 '05 #1
5 1720
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.telia.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
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?)...
3
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...
8
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...
22
by: ypjofficial | last post by:
Hello All, I have following doubt.. class abstractclass { public: abstractclass(){} virtual void method()=0; };
6
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...
6
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...
14
by: junw2000 | last post by:
Is it possible to create an abstract base class without a pure virtual function? Thanks Jack
4
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...
17
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;"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
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...

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.