Click here to Skip to main content
15,910,886 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,I have query when i should use abstract class,what is the use of abstract class over normal class.since Can do same thing with the normal class as well so why i should go for abstrct class,why we create abstact method.
eg
abstract class ABC
{
void myfunc()
{
console.write("hello");

}
abstract void abstfunc();

}
class b: a
{
override void abstfunc(){
console.write("override");}
}
main()
{
class b=new b();
b.abstfunc();
}

the same thing can be done with normal class as well also normal class can be instaintiated.so why we go for abstract class.
class ABC
{
void myfunc()
{
console.write("hello");

}
void virtual abstfunc(){
}

}
class b: a
{
override void abstfunc(){
console.write("override");}
}
main()
{
class b=new b();
b.abstfunc();
}

same implemented i can do using normal class as well just make a virtual function and overvide it.also having a default function myfunction,also i can make object of it.so why i shall go for abstract class.what are the benefit of abstract class and abstract method.
what is the use of this abstract method i can make a virtual function as well.
Posted

Hi
You should really read the documentation from Microsoft, it usually answers these types of questions quite good:
Abstract and seal classes[^]
Classes and structs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900