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 |
What is string pool in c#?
can we access main() using objects?
Will finally block get executed if the exception had not occurred?
You are creating a custom usercontrol, some of the newly created properties are shown in the properties window. How you can hide a new property named theme from the properties window?
What happens if a static constructor throws an exception?
Explain deadlock?
Please write a program to display “welcome to bestinterviewquestion.com” in c#?
What do you mean by a windows process in regards to memory allocation?
What is string in c# net?
If a.equals(b) is true then a.gethashcode & b.gethashcode must always return same hash code.
Suppose in a scenario if we want to display information only until 4.00 p.m and after that means after 4.00 p.m if any one tries to access the information it should give error mesage. Then how will you write a delegate for this ? Give coding.
1 Answers HP, nTech Solutions, Primetech Software, PS,
What does the keyword virtual mean in the method definition?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)