473,325 Members | 2,771 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,325 software developers and data experts.

Abstract class with no abstract functions

I've class C1, C2 and C3. C1 should be abstract, and all functions
should be defined like normal, no-virtual functions. It don't have to
have constructor.
C2 is C1 with constructor.
C3 is C2 with constructor(both take long time and one exclude second)
and additional functions and members.
Haw do it, when I've not pure-virtual function?
I use g++.
Regards.
--
Linux user: #376500 (see http://counter.li.org/)
Jul 23 '05 #1
3 1117
* Uzytkownik:
I've class C1, C2 and C3. C1 should be abstract, and all functions
should be defined like normal, no-virtual functions. It don't have to
have constructor.
C2 is C1 with constructor.
C3 is C2 with constructor(both take long time and one exclude second)
and additional functions and members.
Haw do it, when I've not pure-virtual function?


class C1{ public: virtual ~C1() = 0 }; inline C1::~C1(){}

However, there's something in that design description that sounds
very bad.

Perhaps you're using constructors where ordinary functions would
be more appropriate?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2
Uzytkownik schrieb:
I've class C1, C2 and C3. C1 should be abstract, and all functions
should be defined like normal, no-virtual functions. It don't have to
have constructor.
C2 is C1 with constructor.
C3 is C2 with constructor(both take long time and one exclude second)
and additional functions and members.
Haw do it, when I've not pure-virtual function?
I use g++.
Regards.


What exactly do you want to achieve? If all you want is to prevent
instantiation of C1, add a protected empty inline default ctor. If
that's totally off your problem, it might help if you provided some code
to clarify what you want to do and where exactly your prolem is.

Cheers,
Malte
Jul 23 '05 #3
Alf P. Steinbach wrote:
* Uzytkownik:
I've class C1, C2 and C3. C1 should be abstract, and all functions
should be defined like normal, no-virtual functions. It don't have to
have constructor.
C2 is C1 with constructor.
C3 is C2 with constructor(both take long time and one exclude second)
and additional functions and members.
Haw do it, when I've not pure-virtual function?

class C1{ public: virtual ~C1() = 0 }; inline C1::~C1(){}


It's work.
Thanks.

--
Linux user: #376500 (see http://counter.li.org/)
Jul 23 '05 #4

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

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
4
by: Tony Johansson | last post by:
Hello! Assume you have an abstract class called Body and a derived class called cylinder. When you have an abstract class you can't instansiate an object. As you can see in the abstract class...
12
by: Daedalus.OS | last post by:
Ok first I'm pretty new to OOP, so my question may sound stupid to some of you. If the only answer you can provide is "get a book about OOP" then don't loose your time and mine cause it's already...
4
by: sudhir | last post by:
Q 1. I defined a class with 10 functions . It contains declaration of 5 functions and 5 functions are declared and defined. Is this class is said to a abstract class ? Q 2. Which one is...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.