By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

Abstract class with no abstract functions

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
* 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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.