Inheritance

M

Murali

Hi
I have 2 questions.
1) How do i make a class so that no other classes can't be derive from
my class?
2) Do i declare the constructor as private? Can any one explain when
exactly it is useful?

Thanks & Regards
Murali
 
O

osmium

Rolf Magnus said:
I prefer letting the user of the class decide whether he finds it useful
to
derive from it.

Which is exactly what was proposed in the message you're responding to.
Furthermore, it seems like good choice to me.
 
J

James Kanze

I prefer letting the user of the class decide whether he finds it useful to
derive from it.

Which is, of course, very poor engineering. You can't write
robust code if you don't know what it will be used for. If the
requirement specifications state that the class will be used as
a base class, you write it considerably differently than if they
don't.
 

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
474,297
Messages
2,571,529
Members
48,250
Latest member
Bette22B13

Latest Threads

Top