473,382 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

abstract class

An Abstract Class is a class that represents abstract concepts for which
objects cannot exist.
Instances of abstract classes cannot be created. When is it advisable to
implement an abstract class (instead of Interface)?
Nov 16 '05 #1
3 2281
Peter wrote:
An Abstract Class is a class that represents abstract concepts for which
objects cannot exist.
Instances of abstract classes cannot be created. When is it advisable to
implement an abstract class (instead of Interface)?


An interface can't have *any* code, an abstract baseclass
can contain some code.

I think the general rule is:
if it is (deep down) "the same", use a (possibly abstract) baseclass.
if it is different, but just should *act* the same, use an interface.

--
Hans Kesting
Nov 16 '05 #2
How about:

You implement an AC to create multiple versions of a component, since it
provides a simple and easy way to version your components. By updating the
base class, all inheriting classes are automatically updated with the
change.

Chris

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:up**************@TK2MSFTNGP15.phx.gbl...
Peter wrote:
An Abstract Class is a class that represents abstract concepts for which
objects cannot exist.
Instances of abstract classes cannot be created. When is it advisable to
implement an abstract class (instead of Interface)?


An interface can't have *any* code, an abstract baseclass
can contain some code.

I think the general rule is:
if it is (deep down) "the same", use a (possibly abstract) baseclass.
if it is different, but just should *act* the same, use an interface.

--
Hans Kesting

Nov 16 '05 #3
hi
If you have atleast one concrete implementation of a method you can go for
abstract calss

remember am abstract calss can have methods with implementation

Another diffrence is that an interface method definition can have access
modifier only as public,while an abstract calss method has no such
constrain
regards
Ansil .F
Trivandrum
"Peter" wrote:
An Abstract Class is a class that represents abstract concepts for which
objects cannot exist.
Instances of abstract classes cannot be created. When is it advisable to
implement an abstract class (instead of Interface)?

Nov 16 '05 #4

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

Similar topics

4
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...
12
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...
2
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...
6
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...
7
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...
0
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...
4
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
0
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...
4
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...
6
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.