473,786 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abstract Class

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
Jul 22 '05 #1
16 3528

"Merlin" <me********@hot mail.com> wrote in message
news:12******** *************** ***@posting.goo gle.com...
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.)
Jul 22 '05 #2
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
Jul 22 '05 #3
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.
Jul 22 '05 #4
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?
Jul 22 '05 #5
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
Jul 22 '05 #6

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
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.sy r.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


Jul 22 '05 #7
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.

Jul 22 '05 #8
Howard wrote:

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
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.sy r.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.
Jul 22 '05 #9
"Howard" <al*****@hotmai l.com> wrote in message
news:r_******** *************@b gtnsc05-news.ops.worldn et.att.net...
> 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

Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2309
by: Tony Johansson | last post by:
Hello! Assume you have an abstract class called Body and a derived class called cylinder. When you have an abstract class you can't instansiate an object. As you can see in the abstract class there are one data member called density that you can't access because there will not be any object of class Body. The data member density will be inheritated and all the member functions. So when you have an instance of class Cylinder and you...
12
3098
by: Daedalus.OS | last post by:
Ok first I'm pretty new to OOP, so my question may sound stupid to some of you. If the only answer you can provide is "get a book about OOP" then don't loose your time and mine cause it's already ordered. I'm just too curious about this one to wait for the book. I would like to know is if it's good php programming practice to use abstract classes instead of singleton classes. For exemple a login class. I've made one as an abstract class...
2
9609
by: Dave Veeneman | last post by:
Is is legal to declare abstract members in non-abstract classes? How about non-abstract members in abstract classes? I am writing a base class with three derived classes. The base class will define the behavior for most, but not all of its members. The derived classes will define the behavior for the remaining members (the undefined members). I'd like to force the derived classes to implement the undefined members in the base class. I...
6
5804
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove the need to have abstract class types in C#? Derived classes from abstract base classes must overrided the abstract method defininition anyway, so why not just provide a complete definition for the abstract method when defining the containing...
7
4474
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears to be checking that the correct data type is used DataAcess sets an abstract class and methods
0
2681
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never looked for one on the net (I did browse the boost library though). It doesn't matter right now, anyway. To put it simply, Abstract Iterator is mainly a wrapper class. It helps
4
3207
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
0
2837
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass magic, I wrote the following module. It is mainly useful as a light weight tool to help programmers catch mistakes at definition time (e.g., forgetting to implement a method required by the given interface). This is handy when unit tests or...
4
6569
by: David Zha0 | last post by:
Hi, "when we call a virtual method, the runtime will check the instance who called the method and then choose the suitable override method, this may causes the performance drop down", is this right? And, why not use "new" instead of using "virtual"? And the last question, what is the differences between a abstract method and a interface?
6
4033
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it would be useful to have /some/ data defined in such an abstract class for reasons of forming a common block of data existing in or used by all descendant classes (see example below.) In such a case where a common block of data *always* exists,...
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.