Can you override private virtual methods?




Answers were Sorted based on User's Feedback



Can you override private virtual methods?..

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

Can you override private virtual methods?..

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

Can you override private virtual methods?..

Answer / suresh.gv

we should not use Private Access Specefier for
VIRTUAL ,ABSTRACT ,INTERFACES

Is This Answer Correct ?    14 Yes 4 No




Can you override private virtual methods?..

Answer / kiran

No

virtual or abstract members cannot be private

Is This Answer Correct ?    11 Yes 3 No

Can you override private virtual methods?..

Answer / pk

no

Is This Answer Correct ?    10 Yes 4 No

Can you override private virtual methods?..

Answer / asim bukhari

we cant use private access modifier for VIRTUAL, INTERFACE
and ABSTRACT

Is This Answer Correct ?    7 Yes 2 No

Can you override private virtual methods?..

Answer / faisal

No.

Is This Answer Correct ?    1 Yes 0 No

Can you override private virtual methods?..

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

Can you override private virtual methods?..

Answer / kirti

No. Private methods are not accessible outside the class.

Is This Answer Correct ?    0 Yes 0 No

Can you override private virtual methods?..

Answer / bk sahoo

yes

Is This Answer Correct ?    12 Yes 16 No

Post New Answer



More C Sharp Interview Questions

Explain the process of Serialization?

0 Answers  


Define MSIL, and how does it works? Why our developers need an appreciation of it if at all?

0 Answers   Siebel,


Explain hash table in c# ?

0 Answers  


Why we use anonymous methods in c#?

0 Answers  


What is readline library?

0 Answers  






What is the difference between inheritance and abstract class?

0 Answers  


What is meant by clr?

0 Answers  


Explain when should you call the garbage collector in .net?

0 Answers  


What is int64 in c#?

0 Answers  


Tell me the difference between call by value and call by reference.

0 Answers   NIIT,


What are "class access modifiers" in C#?

0 Answers   Genpact,


How to implement singleton design pattern in c#?

0 Answers  






Categories