Replay for this......

D

Donkey Hot

hi..........

why we can not create an object to abstract class ? tell me the
exact reason ?

If we could do that, there would not be any needs for the "abstract"
keyword in the first place.

An abtract class in kind of an interface, it's not meant to usable as is,
but needs more details to work. Basically it is an interface, but still
containing *some* functionality that need to be implemented later.
 
D

Donkey Hot

@l16g2000hsh.googlegroups.com:

If we could do that, there would not be any needs for the "abstract"
keyword in the first place.

An abtract class in kind of an interface, it's not meant to usable as
is, but needs more details to work. Basically it is an interface, but
still containing *some* functionality that need *NOT* to be implemented
later.
 
R

ram

hi..........

why we can not create an object to abstract class ? tell me the
exact reason ?
 
P

Patricia Shanahan

ram said:
hi..........

why we can not create an object to abstract class ? tell me the
exact reason ?

Because the programmer who wrote the class has explicitly prohibited the
creation of objects - that is what "abstract" means.

Note that the language permits an incomplete implementation of an
abstract class, which is safe because no objects can be created. It may
have abstract methods that are declared but have no method body.

Patricia
 
D

Daniel Pitts

ram said:
hi..........

why we can not create an object to abstract class ? tell me the
exact reason ?
Abstract means that its a concept, not an implementation of that concept.

It would be like asking why you can't live in a picture of a house.
 
W

Wesley Mesquita

hi..........

why we can not create an object to abstract class ? tell me the
exact reason ?

The main objective of an abstract class is to be inherited (it is the
oppsite from 'final'). I have doubts in say that abstract classes are
a kind of interface bacause you can have implemented code, and this
hurts the principle of interfaces as you "know how" the functions are
implemented. For me, abstract classes are usefull to turn polymorphism
easier. Imagine the simple example that you has a class called Animal,
should it be an object since you have classes Horse, Cow, and so on?



Sorry the poor english.
 
L

Lew

Wesley said:
The main objective of an abstract class is to be inherited (it is the
oppsite from 'final'). I have doubts in say that abstract classes are
a kind of interface bacause you can have implemented code, and this
hurts the principle of interfaces as you "know how" the functions are
implemented. For me, abstract classes are usefull to turn polymorphism
easier. Imagine the simple example that you has a class called Animal,
should it be an object since you have classes Horse, Cow, and so on?

Just so. The main purposes of abstract classes are to root a particular
inheritance tree and to provide default implementations of certain behaviors
for their children.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top