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
kumar k
NA
26
23.6k
Can an abstract class have non-abstract methods without implementation?
Apr 27 2011 1:16 PM
Hi ,
Can some one please share their thoughts on this Abstract class ?
using System.ComponentModel;
public abstract class BaseClass:INotifyPropertyChanged
{
protected BaseClass();
protected void OnPropertyChahnged();
public event PropertyChangedEventHandler PropertyChanged;
}
The above code is not compiling as it is looking for method implementations , as non-abstract methods must have body {}.
When i make protected BaseClass(); as Protected BaseClass(){}; bulid succeeds. similarly with OnPropertyChanged() method.
Please consider that the methods were not declared as
abstract
. Without declaring the methods as abstract those methods have empty implementation.(This is what i'm looking to achieve).
I am referring to the above code from .Net 2.0 already existing in one of my proj , just wondering if c#2.0 has some flexibility which allows empty method implementations?
Appreciate your time
cheers,
kumar
Reply
Answers (
12
)
Webbrowser; select radio button
Show Selected Date From Calender