Answered by:
What is Abstract Class ?

Question
-
What is Abstract Class ?
What is Method Decleration
What is Implementation
Thursday, August 11, 2011 2:41 AM
Answers
-
An abstract class is any class which contains abstract methods. Abstract methods don't have a body. Because of this, an abstract class can't be instantiated because if you were to call the method with no body, what would happen? Abstract classes are designed to be inherited.
// This is an abstract class. public abstract class MyClass { // This is a method declaration public abstract void SomeMethod(); } public class DerivedClass: MyClass { // This is an implementation of the abstract method public override void SomeMethod() { } }
Evan- Proposed as answer by RohitArora Thursday, August 11, 2011 4:21 AM
- Marked as answer by Min Zhu Thursday, August 18, 2011 1:45 AM
Thursday, August 11, 2011 2:53 AM -
Hi Kalai R,
The following is quoted from MSDN library.
"Abstract classes are closely related to interfaces.
They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented.
One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class.
A class that is derived from an abstract class may still implement interfaces.
Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed.
They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code"
Please see Abstact Classes for details.
Method Declaration declares a method. See Methods for more information.
"In computer science, an implementation is a realization of a technical specification or algorithm as a program, software component, or other computer system through programming and deployment. Many implementations may exist for a given specification or standard. For example, web browsers contain implementations of World Wide Web Consortium-recommended specifications, and software development tools contain implementations of programming languages." quoted from Wikipedia
Best regards,
Min Zhu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Proposed as answer by Papy Normand Saturday, August 13, 2011 7:18 PM
- Marked as answer by Min Zhu Thursday, August 18, 2011 1:45 AM
Friday, August 12, 2011 9:14 AM
All replies
-
An abstract class is any class which contains abstract methods. Abstract methods don't have a body. Because of this, an abstract class can't be instantiated because if you were to call the method with no body, what would happen? Abstract classes are designed to be inherited.
// This is an abstract class. public abstract class MyClass { // This is a method declaration public abstract void SomeMethod(); } public class DerivedClass: MyClass { // This is an implementation of the abstract method public override void SomeMethod() { } }
Evan- Proposed as answer by RohitArora Thursday, August 11, 2011 4:21 AM
- Marked as answer by Min Zhu Thursday, August 18, 2011 1:45 AM
Thursday, August 11, 2011 2:53 AM -
Hi Kalai R,
The following is quoted from MSDN library.
"Abstract classes are closely related to interfaces.
They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented.
One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class.
A class that is derived from an abstract class may still implement interfaces.
Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed.
They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code"
Please see Abstact Classes for details.
Method Declaration declares a method. See Methods for more information.
"In computer science, an implementation is a realization of a technical specification or algorithm as a program, software component, or other computer system through programming and deployment. Many implementations may exist for a given specification or standard. For example, web browsers contain implementations of World Wide Web Consortium-recommended specifications, and software development tools contain implementations of programming languages." quoted from Wikipedia
Best regards,
Min Zhu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Proposed as answer by Papy Normand Saturday, August 13, 2011 7:18 PM
- Marked as answer by Min Zhu Thursday, August 18, 2011 1:45 AM
Friday, August 12, 2011 9:14 AM -
an Abstract class is a class you can't instantiate: you can only inherit it.
It is something like an Interface, with the difference that some of its methods can contain code.
An Interface, instead, ha only the signs of the members (methods, properties and so on). So you can 'implement' it.
An Interface has only the declaration of methods (id est, only the signs: Sub methodname(parameters)... without 'End Sub')
an Abstract class can have a method with some code 'implemented' in it (and have, obviously, 'End Sub')
Implementation is the operation in which you write some code into some method stub (you implement (write) the code for a method - or a property).
Public MustInherit Class AbstractClass Public Sub foo() ' a method with some code, that derived classes don't change, usually End Sub Public MustOverride Sub foooo() ' a method without code, that you MUST 'implement' End Class Public Interface ImyInterface Sub foo() ' a method you 'can' implement or not, but you MUST have in the class that implements this interface End Interface
please, mark this as answer if it is THE answer
----------------
Diego Cattaruzza
Microsoft MVP - Visual Basic: Development
blog: http://community.visual-basic.it/Diego
web site: http://www.visual-basic.it
- Edited by DiegoCattaruzza Friday, August 12, 2011 10:56 AM code sample
Friday, August 12, 2011 10:48 AM -
0
A abstract class, is a super class which is used to define some common characterstics about an obect, it has below characterstics
a) It cant be instantiated.
b) It can only be used for inherting subcalsses.
Ex:
CAR(Abstract calss): All manufactires of cars will derive there cars from the base class and create there own models, this will have common attributes like tyres, gears, perol tank, so i define this class and give it to manufactures they inheirt this calss and must have all the features as defined above
SUbcalss: BMW: BMW decides to have my calss features as gears and then adds its own verison as Automatic trasnmission, so impliments all things the blueprint(CAR class) tell it and add more features
Mercs, volkswagon etc etc
Method Declaration
Its the signature of function where in u define the Return types/ paramter types/ number of parametrs
Implimenation
Depends on the scenario, it can be interface implimentation, which means class impliments all methods defined on th iterface, so interface has all method defination that is signature, class implimenting the interface has the definition of those methods ie. what youwant to do form function.
Abhinav- Proposed as answer by AB82 Friday, August 12, 2011 2:11 PM
Friday, August 12, 2011 2:11 PM