Abstract class with no abstract functions

U

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?
I use g++.
Regards.
 
A

Alf P. Steinbach

* 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?
 
M

Malte Starostik

Uzytkownik said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top