-1

I have an abstract class which name is abclass,

why i cant create an object like

abclass ab1 = new abclass(); 

from main

I have constructor in abclass also.

Sam Leach
  • 12,746
  • 9
  • 45
  • 73
Taha Karaca
  • 111
  • 1
  • 1
  • 10
  • This may be helpful to you, as far as a work-around. http://stackoverflow.com/questions/515876/c-creating-an-instance-of-an-abstract-class-without-defining-new-class – Tricky12 Aug 19 '13 at 13:21

3 Answers3

1

You cannot create an instance of an abstract class.

If you don't provide an implementation for some methods on your abstract class, it cannot, obviously, work.

I suggest you Google 'abstract classes' for more information.

If you want to instantiate your class, remove the abstract keyword.

Sam Leach
  • 12,746
  • 9
  • 45
  • 73
0

Read about "Abstract Classes" in MSDN

It is beautifully explained !!!!

Microsoft DN
  • 9,706
  • 10
  • 51
  • 71
0

The reason is: Abstract class can not be instantiated .

Lets do some basics here:

check http://msdn.microsoft.com/en-us/library/ms173150.aspx

Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234