Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 14th, 2006, 6:29 PM   #11
Kaja Fumei
Hobbyist Programmer
 
Join Date: Oct 2005
Posts: 134
Rep Power: 4 Kaja Fumei is on a distinguished road
In order to not be abstract, a subclass must define its own version of Feed(). Suppose I made a Shark subclass (poor other fish trying to eat and they get eaten by a shark), and it didn't implement Feed(). This is valid class, but it would be abstract because it didn't implement Feed. And therefore, you could not declare a Shark object. But if you had several Shark subclasses (GreatWhite, HammerHead, etc), and they implemented Feed(), they would not be abstract.
Kaja Fumei is offline   Reply With Quote
Old Apr 14th, 2006, 7:38 PM   #12
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
In other words(easier to understand), an abstract class is used as an outline. You won't use an abstract class to create objects and such, the concrete(derived) classes of the fish(such as sunfish, shark, whale) will be the objects the programmer would create.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Apr 14th, 2006, 7:48 PM   #13
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
Correct jayme, although in this Fish example, it might be more appropriate to say that concrete classes will be particular species of fish. Of course, that depends on what the application is trying to do ..... if there is a valid reason for having a concrete Shark class (as opposed to an abstract Shark and concrete WhitePointer and GreyNurse) then that's a design decision. Most real-world designs involve some form of trade-off like that. It might also be appropriate to have a concrete Shark class if data characterising each shark are being read from some form of database (we wouldn't want the program capability to be limited just because we forgot to create a class for a particular type of shark, even if it can be represented in the database).

And a whale is not a fish
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC