Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on concrete class and abstract within the C# forums, part of the Software Development category; what is concrete class and abstract class give their difference?...
|
|||||||
|
|||
|
Re: concrete class and abstract
what is concrete class and abstract class give their difference?
Concrete class is nothing but normal class, we can use as a base class or may not.Not compulsory, it can't contain abstract methods.we can create object and work with this class. class Sample { public void MyMethod() {..............} } Abstract class:- Abstract class is class which declared with a keyword Abstract, Must be used as a base class. Only intension to declare a abstract class is to use as a base class,that is we can't create object of this class like concrete class. It can contain abstract methods as well as concrete(normal) methods. public abstract class MyClass { public void MyMethod() {..............} public abstract TestMethod() { ......... } } Last edited by shilpa.c; 08-25-2009 at 04:09 AM. |
|
|||
|
Re: concrete class and abstract
Quote:
Abstract class is a class that has no direct instances, but whose descendants may have direct instances. There are case i which it is useful to define classes for which the programmer never intends to instantiate any objects; because such classes normally are used as bae-classes in inheritance hierarchies, we call such classes abstract classes These classes cannot be used to instantiate objects; because abstract classes are incomplete. Derived classes called concrete classes must define the missing pieces. Eg: public abstract class Geek { //...Class implementation public abstract member() { } } Concrete class is a normal class, Like, public class Geek { public void method() { ..... } } Thanks & Regards, Riju. |
|
|||
|
Re: concrete class and abstract
If a Class can be used to create object : then it will be Concrete Class
If a Class is not made for Object Creation : then it will be Abstract Class, but it must have a abstract method declaration inside it & without definition. ( If in a class there is a single Abstract function then, this class must be Abstract class) |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can we use abstract method without using abstract class ? | karthikeyan_ramaraj | Java | 5 | 2 Weeks Ago 05:20 AM |
| Difference between interface and abstract class? are they both same | mahesh9920 | OOPS | 29 | 4 Weeks Ago 08:18 AM |
| Why ActionForm class is a abstract? | timmireddy | Java | 0 | 07-09-2009 06:34 AM |
| HttpServlet abstract class | chandra.mr | Java | 2 | 03-24-2008 02:55 AM |
| Abstract Class Situation | Geek_Guest | Java | 7 | 10-24-2007 12:43 AM |