Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Mar 7th, 2014, 5:34 AM   #1
F.M.C
Newbie
 
Join Date: Mar 2014
Posts: 4
Rep Power: 0 F.M.C is on a distinguished road
Question abstract classes

Is it possible to have an abstract class without an abstract method?
F.M.C is offline   Reply With Quote
Old Mar 7th, 2014, 11:39 AM   #2
Ancient Dragon
Achieved Level 70

 
Ancient Dragon's Avatar
 
Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 4,345
Rep Power: 10 Ancient Dragon will become famous soon enoughAncient Dragon will become famous soon enough
Re: abstract classes

No.
__________________
PFO's FAQ is here
Forum Rules

There is no cow level (Diablo III)
If you never push yourself you will never improve (Diablo III)
Ancient Dragon is offline   Reply With Quote
Old Mar 7th, 2014, 1:41 PM   #3
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 771
Rep Power: 12 King is on a distinguished road
Re: abstract classes

Actually in C# you can, and makes sense in some situation.
http://stackoverflow.com/questions/3...bstract-method
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Mar 24th, 2014, 2:08 AM   #4
exception
Software & Web Developer
 
exception's Avatar
 
Join Date: Oct 2008
Location: Philippines
Posts: 173
Rep Power: 9 exception is on a distinguished road
Send a message via Yahoo to exception
Re: abstract classes

why do someone create an Abstract class without an abstract method? yes you can, but that is the main reason why you use abstract because you can have some implementations. use Interface instead.
__________________
|Knowledge alone is not POWER, Applied knowledge is POWER.
exception is offline   Reply With Quote
Old Mar 24th, 2014, 10:07 AM   #5
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 771
Rep Power: 12 King is on a distinguished road
Re: abstract classes

One nice pattern is to have an interface, and then an abstract class that implements some of that interface, or adds a number of helpful methods. This way you can inherit from the abstract class if you want some partial functionality, or inherit from the interface if you don't need any of that functionality. It is hard to give direction when you didn't give any information on what you are implementing.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Mar 24th, 2014, 9:34 PM   #6
exception
Software & Web Developer
 
exception's Avatar
 
Join Date: Oct 2008
Location: Philippines
Posts: 173
Rep Power: 9 exception is on a distinguished road
Send a message via Yahoo to exception
Re: abstract classes

Yes exactly is! I could not agree more.
__________________
|Knowledge alone is not POWER, Applied knowledge is POWER.
exception 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Meh some Classes! squills C++ 9 Jun 10th, 2013 4:39 PM
Assignment Help - Need Help Integrating Classes joearness Java 2 Mar 6th, 2012 7:43 PM
AbstractNeuron - Correct and Good Use of Abstract Base Classes, or Not? lrh9 Python 1 Dec 31st, 2011 4:43 PM
Should I Be Using Static Classes? King C# 3 May 12th, 2009 7:47 AM
Could some please explain classes to me... TCStyle C++ 10 Feb 20th, 2006 3:51 PM




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

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