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
Differentiate between managed and unmanaged code? Managed code is the code that is implemented directly by the CLR instead of the operating system. The code compiler first comp

You can post back to any of the page and pages in other application, too. But if you are posting pages to other application, the PreviousPage property will return null. This is an

how to access global resource file using javascript

Mention the name of the directory where it is essential to locate the proxy file to use a Web service. The proxy file must be kept in the /bin directory. This directory is situ

what is Entity-relationship diagram for e-resource planner software

Design the following interface and add code to the command buttons to achieve the following using case statement. I) find coursework to be calculated using the following formula:-0

C# coding to include user specified screen recording to app Project Description: Reposting as selected coder didn't read brief and accepted job to do then tell me would be in

Djvu view and setup,  sourcecode with nice UI Project Description: i want an application build for viewing djvu files -must include setup -must include source code -

What is an IL? Intermediate Language is also called as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL

What is Thread.Sleep() The Thread's execution can be paused by calling Thread.Sleep method. This Thread.Sleep() method takes an integer value which  determines how long the thr