abstract

T

Tony Johansson

Hello!

I'm reading in a book about C++ and they say that the class definition below
is abstract is that really true.
The definition of a class to be abstract is when at least one member is
defined as pure virtual and in this case we have no pure virtual members.


class AttributedObject
{
protected:
virtual ~AttributedObject();
};

AttributedObject::~AttributedObject()
{}

//Tony
 
T

Thomas Maier-Komor

Tony said:
Hello!

I'm reading in a book about C++ and they say that the class definition below
is abstract is that really true.
The definition of a class to be abstract is when at least one member is
defined as pure virtual and in this case we have no pure virtual members.


class AttributedObject
{
protected:
virtual ~AttributedObject();
};

AttributedObject::~AttributedObject()
{}

//Tony

don't believe everything that is stated in a book...

section 10.4 of ISO14882 says: "A class is abstract if it has at least
one pure virtual function."

the mentioned class AttributedObject does not have a pure virtual
function.

Tom
 
P

puneet

Hello ,

This is an IEEE recommendation that for a class to be abstract ,
atleast it should have one pure virtual function. So in any
imlementation it cannot be an
abstract class.So don't go by books , go by standards.

Puneet
 

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,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top