What is the difference between class and abstract class?
Answers were Sorted based on User's Feedback
Answer / chandra kiran
we are unable to create a object for abstract classes
so it is used only as a base class for inheritance
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / srinivas dumpeti
Class is a set of objects and instances
where as abstract class in that their is no declaration,and
that can be inherit to dervied class that is known as
concrete methods..
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / sravanthi
A class is a template that defines the form of all
objects.where as abstract class provides a contract between
service providers and its clients.an abstract class can
provide implementation.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / chandra kiran
we are unable to create a object for abstract class. This is only used as a base class for inheritance
Is This Answer Correct ? | 1 Yes | 0 No |
A class can create 'n' number of objects, but the abstract
class cannot.the abstract class inherits with base class to
use an object.
Examples:Topics Inheritance and interfaces
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ajit singh
1>A Class is a collection of objects,we can create the object of a class but in case of abstract class we unable to carete the object and no decleration.
2> class can contain method and definations,abstract class having all methods abstract
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vijay kumar
Class can create 'n' numbers of objects but abstract class
can only create reference object.and bydefault scope of the
abstract class is public while simple class bydefault internal.
Is This Answer Correct ? | 1 Yes | 1 No |
class is a container for methods, and i can access those
methods by creating the object of my class, and then using
the dot operator with my object to access those methods.
example: radix obj = new radix();
[where class name is radix, obj is the object of my class
radix]
now assume that my class contains a method to add two
integer values and the name of that method is add(), i can
access add by telling the compiler
example: obj.add();
but sometimes a situation comes where i do not want to
create an object of my class, their i can use the abstract
keyword
this is because the methods of my base class can be
accessed by my derived class by using : in c# so their is
no use of creating the object of the base class because by
default every method can be acessed of the base class so
instead of creating object of the base class i can create
the object of my derived class and can access function of
my base class...
if u still have confusion try this code out
using System;
abstract class Radix
{
public void fun()
{
Console.WriteLine("hello dude");
}
}
class me:Radix // inheriting base class radix
{
void funt()
{
Console.WriteLine("hi, dude");
}
static void Main()
{
me obj = new me(); //derived class object
obj.fun();//accessing base class method
obj.funt();
Console.Read();
}
}
i hope this exaqmple helps for further help contact me on
my mail id
mailme.rsharp@rediffmail.com
Thanks and Regards,
Radix.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / kanan
Following are some differences.
1) You can not create object of an abstract class.
2) When you inherits abstract class , than you have to
implement (override) its abstract methods.
Is This Answer Correct ? | 0 Yes | 0 No |
Why do we use static class in c#?
What are satellite assemblies?
How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?
What is a Command Object in C#?
Does C# support multiple inheritance?
3 Answers IBM, Siebel Systems, Visual Soft,
What is expandoobject in c#?
Is string mutable in c#?
Is cli same as the clr?
What is serialization and deserialization in c# with example?
Explain the difference between .net and c#?
What are extender provider components?
Can a loop recorder detect a heart attack?