Can you override private virtual methods?
Answers were Sorted based on User's Feedback
Answer / umesh
No, moreover, you cannot access private methods in
inherited classes, have to be protected in the base class to
allow any sort of access.
Is This Answer Correct ? | 28 Yes | 6 No |
Answer / payal mehta
WE can not use private access modifier for VIRTUAL,INTERFACE
and also we can not inherit private methods or properties
in inherited classes.
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / asim bukhari
we cant use private access modifier for VIRTUAL, INTERFACE
and ABSTRACT
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / vivek
virtual or abstract members cannot be private.
Ex: error occurs during the static compilation phase, which
means that no program that declares a private virtual method
will ever be executed in any way.
C#
class A
{
private virtual int Test()
{
return 1;
}
}
class Program
{
static void Main()
{
}
}
Compile-time error
Error 1
'A.Test()': virtual or abstract members cannot be private
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kirti
No. Private methods are not accessible outside the class.
Is This Answer Correct ? | 0 Yes | 0 No |
How we convert private assembly into public assembly?
What is a pre-requisite for connection pooling?
What does readonly mean in c#?
What are the different types of comments in c#?
What statements can enclose a "continue" statement?
What is instantiating a class?
What is ilasm.exe used for?
what is dynamic sql
Can you explicitly call a destructor?
How can you set image source dynamically from c# application to ”test.png” file?
Enlist all the components of an ado.net framework?
i have a table named login in mysql database containing (empid,fname,lname,mobno,emailid,usrname,usrpwd) i have 2 textboxes in which i enter my username and pwd..so based on what is entered in those textboxes it should retreive all other details of dat username in the remaining 6 textboxes..i want the code for this...