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

How we convert private assembly into public assembly?

0 Answers   Wipro,


What is a pre-requisite for connection pooling?

2 Answers  


What does readonly mean in c#?

0 Answers  


What are the different types of comments in c#?

0 Answers  


What statements can enclose a "continue" statement?

3 Answers   Fortech,






What is instantiating a class?

0 Answers  


What is ilasm.exe used for?

0 Answers  


what is dynamic sql

2 Answers   TCS, Wipro,


Can you explicitly call a destructor?

0 Answers  


How can you set image source dynamically from c# application to ”test.png” file?

0 Answers  


Enlist all the components of an ado.net framework?

0 Answers  


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...

1 Answers   Royal Enfield,


Categories