Abstract classes, DOT NET Programming

What are abstract classes?

The features of the abstract class are as follows:-

1.     You can not create an object of the abstract class.

2.     The Abstract class is designed to act as a base class (to be inherited by another classes). In the program development  the Abstract class is a design concept and provides a base upon which other classes are built.

3.     The Abstract classes are similar to the interfaces. After declaring an abstract class, it can't be instantiated on its own, it must be inherited.

4.     In VB.NET abstract classes are created by using the "MustInherit" keyword.In the C# we have "Abstract" keyword.

5.     The Abstract classes can have implementation or pure abstract methods which must be implemented in the child class.

Public MustInherit Class ClsAbstract

' use the mustinherit class to declare the class as abstract

Public Function Add(ByVal intnum1 As Integer, ByVal intnum2 As

Integer) As Integer

Return intnum1 + intnum2

End Function

' left this seconf function to be completed by the inheriting class

Public MustOverride Function MultiplyNumber(ByVal intnum1 As

Integer, ByVal intnum2 As Integer) As Integer

End Class

Public Class ClsChild

Inherits ClsAbstract

' class child overrides the Multiplynumber function

Public Overrides Function MultiplyNumber(ByVal intnum1 As

Integer, ByVal intnum2 As Integer) As Integer

Return intnum1 * intnum2

End Function

End Class

1945_abstract classes.png

Posted Date: 9/21/2012 8:50:41 AM | Location : United States







Related Discussions:- Abstract classes, Assignment Help, Ask Question on Abstract classes, Get Answer, Expert's Help, Abstract classes Discussions

Write discussion on Abstract classes
Your posts are moderated
Related Questions

Project Description: I want a new payment gateway of my own. Anyone who has previous experience in preparing a new payment gateway. I mean new payment gateway not any integratio

Explain ADO.NET in brief. ADO.NET is a very significant feature of .NET Framework, which is used to work with data that is stored in structured data sources, like databases and

Connect a Software Application to a Database Backend Acquire the knowledge and develop the skills needed to prototype an end user application using a rapid application dev

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

CRM and Shaerpoint We are using 365+ CRM in the cloud for QuattroCitta at the moment which we will migrate to our own private cloud in six months (project part 2). Within ShareP

How to Learn Dot Net Online and get online certificate ?

What is XML Text Reader? The "XmlTextReader" class helps to give fast access to streams of XML data in a forward-only and read-only manner. The XMLTextReader also checks if the

Define an event. Whenever an action takes place in a class, that class gives a notification to other classes or objects that are assigned to perform certain tasks. These notifi

What are different types of caching using in ASP.NET? You can use 2 types of output caching to cache information which is to be transmitted to and displayed in a Web browser: