Results 1 to 8 of 8

Thread: concrete class and abstract

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Answers
    7

    concrete class and abstract

    what is concrete class and abstract class give their difference?


  2. #2
    Junior Member
    Join Date
    Nov 2007
    Answers
    24

    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 03:09 AM.

  3. #3
    Expert Member
    Join Date
    May 2009
    Answers
    1,374

    Re: concrete class and abstract

    Quote Originally Posted by dprakashraj View Post
    what is concrete class and abstract class give their difference?
    Hi Prakashraj,

    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.


  4. #4
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    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)


  5. #5
    Junior Member
    Join Date
    Sep 2009
    Answers
    1

    Re: concrete class and abstract

    any thing more


  6. #6
    Junior Member
    Join Date
    May 2010
    Answers
    6

    Re: concrete class and abstract

    Concrete class are normal classes which can be instantiated but abstract classes can not.i.e, we can not create the objects for abstract classes using new keyword as they dont have methods implemented.so runtime doesnt understand how much memory has to be alloted for abstract class.


  7. #7
    Junior Member
    Join Date
    Jun 2010
    Answers
    1

    Re: concrete class and abstract

    Re: concrete class and abstract

    --------------------------------------------------------------------------------

    Concrete class are normal classes which can be instantiated but abstract classes can not.i.e, we can not create the objects for abstract classes using new keyword as they dont have methods implemented.so runtime doesnt understand how much memory has to be alloted for abstract class.


  8. #8
    Junior Member
    Join Date
    Jun 2010
    Answers
    1

    Re: concrete class and abstract

    Abstract classes normally contain one or more abstract methods or abstract properties, such methods or properties do not provide implementations, but our derived classes must override inherited abstract methods or properties to enable obejcts ot those derived classes to be instantiated, not to override those methods or properties in derived classes is syntax error, unless the derived class also is an abstract class



    Example

    public abstract class Shape
    {
    //...Class implementation

    public abstract void Draw(int x, int y)
    {
    //this method mustn't be implemented here.
    //If we do implement it, the result is a Syntax Error.
    }
    }


    public abstract class Shape2D : Shape
    {
    //...Class implementation
    //...you do not have to implement the the method Draw(int x, int y)
    }

    public class Cricle : Shape2D
    {
    //here we should provide an implemetation for Draw(int x, int y)
    public override void Draw(int x, int y)
    {
    //must do some work here
    }

    }


  9.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact