Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 110.8k

Abstraction query

Feb 19 2019 4:52 AM
Dear All,
 
I get a code, which is given below:
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. namespace DemoApplication  
  7. {  
  8. abstract class Tutorial  
  9. {  
  10. public virtual void Set()  
  11. {  
  12. }  
  13. }  
  14. class Guru99Tutorial:Tutorial  
  15. {  
  16. protected int TutorialID;  
  17. protected string TutorialName;  
  18. public void SetTutorial(int pID,string pName)  
  19. {  
  20. TutorialID=pID;  
  21. TutorialName=pName;  
  22. }  
  23. public String GetTutorial()  
  24. {  
  25. return TutorialName;  
  26. }  
  27. static void Main(string[] args)  
  28. {  
  29. Guru99Tutorial pTutor=new Guru99Tutorial();  
  30. pTutor.SetTutorial(1,".Net");  
  31. Console.WriteLine(pTutor.GetTutorial());  
  32. Console.ReadKey();  
  33. }  
  34. }  
  35. }  
In this example, there is no abstract method. and use only virtual method.
 
So we can use abstract class without abstract method? Please clear in brief.
 
Thanks and Regards
Ankit Shukla

Answers (1)