C# Programming - Polymorphism - Discussion
Discussion Forum : Polymorphism - General Questions (Q.No. 7)
7.
Which of the following statements is correct?
Discussion:
4 comments Page 1 of 1.
Andrue Cope said:
1 decade ago
'B' is sneakily wrong. An abstract method is implicitly virtual so you can't declare them as such. As per 10.6.6 of the the C# 3.0 spec:
'When an instance method declaration includes an abstract modifier, that method is said to be an abstract method. Although an abstract method is implicitly also a virtual method, it cannot have the modifier virtual.'
'When an instance method declaration includes an abstract modifier, that method is said to be an abstract method. Although an abstract method is implicitly also a virtual method, it cannot have the modifier virtual.'
Tiny said:
1 decade ago
[B] Abstract methods can be virtual.
The Following code is An abstract method that is virtual. Also [D] is correct
abstract class Journal
{
abstract virtual public void Issue()
{
// Implementation code
}
}
The Following code is An abstract method that is virtual. Also [D] is correct
abstract class Journal
{
abstract virtual public void Issue()
{
// Implementation code
}
}
Vikrant said:
1 decade ago
We can't write the abstract virtual in abstract method. it gives an error "Abstract method Issue() cannot be marked virtual"
VHeddoori said:
1 decade ago
Abstract methods are implicit virtual methods.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers