TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
600
70.8k
Abstract class
Nov 5 2014 4:04 AM
A class that you create only to
extend
from, but not to instantiate from, is an abstract class. This is what definition says for an abstract class.
In the following program
Test
is an abstract class. And test1 and test2 are instantiations. How can this situation be explained?. Problem is highlighted.
using System;
abstract class
Test
{
public int _a;
public abstract void A();
}
class Example1 : Test
{
public override void A()
{
Console.WriteLine("Example1.A");
base._a++;
}
}
class Example2 : Test
{
public override void A()
{
Console.WriteLine("Example2.A");
base._a--;
}
}
class Program
{
static void Main()
{
// Reference Example1 through Test type.
Test
test1
= new Example1();
test1.A();
// Reference Example2 through Test type.
Test
test2
= new Example2();
test2.A();
Console.Read();
}
}
Reply
Answers (
2
)
Add item count to icon on button - C#.net
how to insert date in sql server as 31-12-9999.