Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Is it compulsory to have atleast one abstract method in
abstract class?

Answer Posted / jatin

NO,It is not mandatory to write abstract members in Abstract
Class. I Repeat <IT IS NOT MANDATORY> ,If anyone have doubt
regarding this than simply make a program then everything
will be cleared, FOR YOUR CLARIFICATION I AM MAKING 1 SIMPLE
PROGRAMME FOR U GUYS
HOPE U WILL ENJOY AFTER READING THIS ..

program in console application:

namespace ConsoleApplication1
abstract class absClass
{
//A Non abstract method
protected virtual int AddTwoNumbers(int a, int b)
{
return a + b;
}

}
class absDerived : absClass
{
protected override int AddTwoNumbers(int Num1, int Num2)
{
int n = Num1 + Num2;
Console.WriteLine("sum of method is:" + n);
return n;
}
static void Main()
{
//You can create an
//instance of the derived class
absDerived calculate = new absDerived();
int sum = calculate.AddTwoNumbers(10, 20);
Console.WriteLine("{0}", sum);
Console.Read();
}
}
}


All the best ... :)

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is output buffer?

1014


Is an array a vector?

986


What is the difference between instanceof and isinstance?

1004


What happens if we override private method?

935


what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

934


Does java arraylist maintain insertion order?

955


Which is better arraylist or vector?

989


What are the rules for variable declaration?

926


Is java developer a good career?

982


How do you check if a number is a perfect square?

956


Is there any sort function in java?

1006


Can a class declared as private be accessed outside it’s package?

973


What is meant by class loader? How many types are there? When will we use them?

937


Can we clone singleton object?

1024


How do I know if java is installed?

1035