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
Eric Fowler
NA
1
0
How to prevent derived class clts from using base class fxn
Mar 21 2013 12:10 PM
I have a base and derived class, as follows:
class BaseClass
{
public BaseClass(string str){ ... do stuff with str ...};
};
class DerivedClass : BaseClass
{
public Foo(string str, IntPtr ptr) { ... do stuff with str and ptr ....}
};
// Other classes can derive from BaseClass ....
Client code looks like this:
DerivedClass dc = new DerivedClass();
dc.Foo("Hello"); // <--- note no IntPtr being passed.
In these cases, the base class function is being called.
What I want is a compile time error.
How to get one?
Reply
Answers (
1
)
what is the meaning of reference type and value type
c# and ms access database problem asap