Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Abstract Class

Reply
Thread Tools

Abstract Class

 
 
Merlin
Guest
Posts: n/a
 
      05-17-2004
Hi

Been reading the GOF book and started to make the distinction between
Class and Interface inheritance. One question though:

Do pure abstract classes have representations? (data members?)
What about abstract classes?

Should abstract classes have a destructor and or constructor? What
about pure abstract classes?

What are the conditions that must be satisfied for a class to be

A) Pure Abstract class
B) Abstract Class

Regards

Merlin
 
Reply With Quote
 
 
 
 
jeffc
Guest
Posts: n/a
 
      05-17-2004

"Merlin" <> wrote in message
news: om...
> Hi
>
> Been reading the GOF book and started to make the distinction between
> Class and Interface inheritance. One question though:
>
> Do pure abstract classes have representations? (data members?)
> What about abstract classes?


I wouldn't try to make a big deal out of the difference. I don't think
there is any such thing as "pure abstract class" in the strict C++ sense (I
doubt it's mentioned in the standard - could be wrong.) The point is that
abstract classes might or might not have data. If any abstract class has no
data, some people call that a pure abstract class. I guess that distinction
is made by people who it never occurred to that you could do that.

> Should abstract classes have a destructor and or constructor? What
> about pure abstract classes?


Of course if there is no data, or "state", then there is no reason to have a
constructor or destructor. Of course there can be exceptions - an abstract
class might still have a base class, for example.

> What are the conditions that must be satisfied for a class to be
>
> A) Pure Abstract class
> B) Abstract Class


B) it should have a pure virtual function. A) there really isn't one, other
than the fact that most people consider an abstract class with no function
to be "pure" ("pure" interface, that is.) (I'm talking about C++ of course.
I don't know if GoF refers to "pure abstract class" in a more general
context with a more specific definition.)


 
Reply With Quote
 
 
 
 
Alan Johnson
Guest
Posts: n/a
 
      05-17-2004
Merlin wrote:

> Hi
>
> Been reading the GOF book and started to make the distinction between
> Class and Interface inheritance. One question though:
>
> Do pure abstract classes have representations? (data members?)


No. "pure abstract class" is typically used to mean a class with nothing
but pure virtual functions (i.e. no function implementations, no data).

> What about abstract classes?


I'm not sure if there is any official definition for this, but any class
that contains at least one pure virtual function, and thus cannot be
directly instantiated, would be abstract. Since it cannot be
instantiated, talking about whether it has any representation if fairly
meaningless.


> Should abstract classes have a destructor and or constructor? What
> about pure abstract classes?


I can't think of any reason why a constructor would be required. Having
a virtual destructor, however, is important if you ever expect an object
to be deleted via a pointer to the abstract base class.

> What are the conditions that must be satisfied for a class to be
>
> A) Pure Abstract class
> B) Abstract Class


See above.

>
> Regards
>
> Merlin


Alan
 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      05-17-2004
Merlin wrote:
> Been reading the GOF book and started to make the distinction between
> Class and Interface inheritance. One question though:


One? Really?

>
> Do pure abstract classes have representations? (data members?)


Some do, some don't. Up to you.

> What about abstract classes?


What about them?

> Should abstract classes have a destructor and or constructor? What
> about pure abstract classes?


They should when needed.

> What are the conditions that must be satisfied for a class to be
>
> A) Pure Abstract class
> B) Abstract Class


Homework questions should be answered by reading your textbook.
 
Reply With Quote
 
Julie
Guest
Posts: n/a
 
      05-17-2004
Victor Bazarov wrote:
>
> Merlin wrote:
> > Been reading the GOF book and started to make the distinction between
> > Class and Interface inheritance. One question though:

>
> One? Really?
>
> >
> > Do pure abstract classes have representations? (data members?)

>
> Some do, some don't. Up to you.
>
> > What about abstract classes?

>
> What about them?
>
> > Should abstract classes have a destructor and or constructor? What
> > about pure abstract classes?

>
> They should when needed.
>
> > What are the conditions that must be satisfied for a class to be
> >
> > A) Pure Abstract class
> > B) Abstract Class

>
> Homework questions should be answered by reading your textbook.


What is the purpose of such senseless non-responses and blind assumptions?
 
Reply With Quote
 
Alan Johnson
Guest
Posts: n/a
 
      05-17-2004
Julie wrote:

> Victor Bazarov wrote:
>
>>Merlin wrote:
>>
>>>Been reading the GOF book and started to make the distinction between
>>>Class and Interface inheritance. One question though:

>>
>>One? Really?
>>
>>
>>>Do pure abstract classes have representations? (data members?)

>>
>>Some do, some don't. Up to you.
>>
>>
>>>What about abstract classes?

>>
>>What about them?
>>
>>
>>>Should abstract classes have a destructor and or constructor? What
>>>about pure abstract classes?

>>
>>They should when needed.
>>
>>
>>>What are the conditions that must be satisfied for a class to be
>>>
>>>A) Pure Abstract class
>>>B) Abstract Class

>>
>>Homework questions should be answered by reading your textbook.

>
>
> What is the purpose of such senseless non-responses and blind assumptions?


I'm sorry. This is not the appropriate newsgroup in which to ask your
philosophy homework questions.



Alan
 
Reply With Quote
 
Howard
Guest
Posts: n/a
 
      05-17-2004

"Julie" <> wrote in message
news:...
> Victor Bazarov wrote:
> >
> > Merlin wrote:
> > > Been reading the GOF book and started to make the distinction between
> > > Class and Interface inheritance. One question though:

> >
> > One? Really?
> >
> > >
> > > Do pure abstract classes have representations? (data members?)

> >
> > Some do, some don't. Up to you.
> >
> > > What about abstract classes?

> >
> > What about them?
> >
> > > Should abstract classes have a destructor and or constructor? What
> > > about pure abstract classes?

> >
> > They should when needed.
> >
> > > What are the conditions that must be satisfied for a class to be
> > >
> > > A) Pure Abstract class
> > > B) Abstract Class

> >
> > Homework questions should be answered by reading your textbook.

>
> What is the purpose of such senseless non-responses and blind assumptions?


C'mon, Julie...

look at those questions! Who but an instructor or test writer would
write questions like that? Seriously, do you think that anyone would ever
actually have come up with those questions out of curiosity? Also, the post
comes via news.maxwell.syr.edu, which sure looks like a school site to me.
I have seen that you like to defend others against this kind of assumption,
which is, I suppose, laudable. But this looks very much like homework to
me, (and to Victor also, apparently). And this is not the place to get your
homework done by others.

What is the purpose? To shame them into doing their own work, I
suppose.

-Howard








 
Reply With Quote
 
E. Robert Tisdale
Guest
Posts: n/a
 
      05-17-2004
Julie wrote:

> Victor Bazarov wrote:
>
>>Homework questions should be answered by reading your textbook.

>
> What is the purpose of such senseless non-responses and blind assumptions?


Victor is "burnt out" again.
He answers new subscribers' questions politely and cheerfully
for months on end then he descends into these dark little episodes.
Take a break Victor.

But I agree with Victor.
I think Merlin has posted homework questions.
We don't mind helping people with their homework
but we don't want to frustrate their instructors either.
Merlin will get lots of help (even from Victor)
if he will attempt to answer the questions himself first.

 
Reply With Quote
 
Julie
Guest
Posts: n/a
 
      05-17-2004
Howard wrote:
>
> "Julie" <> wrote in message
> news:...
> > Victor Bazarov wrote:
> > >
> > > Merlin wrote:
> > > > Been reading the GOF book and started to make the distinction between
> > > > Class and Interface inheritance. One question though:
> > >
> > > One? Really?
> > >
> > > >
> > > > Do pure abstract classes have representations? (data members?)
> > >
> > > Some do, some don't. Up to you.
> > >
> > > > What about abstract classes?
> > >
> > > What about them?
> > >
> > > > Should abstract classes have a destructor and or constructor? What
> > > > about pure abstract classes?
> > >
> > > They should when needed.
> > >
> > > > What are the conditions that must be satisfied for a class to be
> > > >
> > > > A) Pure Abstract class
> > > > B) Abstract Class
> > >
> > > Homework questions should be answered by reading your textbook.

> >
> > What is the purpose of such senseless non-responses and blind assumptions?

>
> C'mon, Julie...
>
> look at those questions! Who but an instructor or test writer would
> write questions like that? Seriously, do you think that anyone would ever
> actually have come up with those questions out of curiosity? Also, the post
> comes via news.maxwell.syr.edu, which sure looks like a school site to me.
> I have seen that you like to defend others against this kind of assumption,
> which is, I suppose, laudable. But this looks very much like homework to
> me, (and to Victor also, apparently). And this is not the place to get your
> homework done by others.
>
> What is the purpose? To shame them into doing their own work, I
> suppose.
>
> -Howard


I've said it before, and I'll continue to say it: answer the question asked,
give the poster the credibility to be able to ask questions for the answers
they desire, and stop w/ the assumptions.

Regardless of your ideas about the motivations of the original poster, the
questions have value and merit discussion in the forum. If a respondent
doesn't have anything constructive to add (such as was the case w/ Victor's
response), move on; the senseless blather provides absolutely no benefit to the
community.
 
Reply With Quote
 
David White
Guest
Posts: n/a
 
      05-18-2004
"Howard" <> wrote in message
news:r_aqc.77633$...
> > > > What are the conditions that must be satisfied for a class to be
> > > >
> > > > A) Pure Abstract class
> > > > B) Abstract Class
> > >
> > > Homework questions should be answered by reading your textbook.

> >
> > What is the purpose of such senseless non-responses and blind

assumptions?
>
> C'mon, Julie...
>
> look at those questions! Who but an instructor or test writer would
> write questions like that?


They might be homework, but now I'm curious. Abstract classes I know, but
"pure abstract classes" I haven't come across. I would have guessed that
"pure" somehow came across from "pure virtual" and is redundant or
inappropriate. Or is a "pure abstract class" one that contains nothing but
an interface of pure virtuals? If so, "pure abstract" sounds more like an OO
term than a C++ term.

DW



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference between abstract class and pure abstract class? skishorev@yahoo.co.in C++ 4 05-17-2006 08:07 AM
Abstract Methods & Abstract Class Iyer, Prasad C Python 0 10-20-2005 06:35 AM
About abstract class and abstract method Sameer Java 4 08-31-2005 12:59 AM
Deriving abstract class from non-abstract class Matthias Kaeppler Java 1 05-22-2005 01:28 PM
Abstract class with no abstract functions Uzytkownik C++ 3 04-03-2005 05:45 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57