Abstraction is showing the working of the machine but not the internal parts of the machine or the complexity of the machine. An abstract class cannot be instantiated. Only abstract methods can be declared in an abstract class which is necessary for the class, without them the class is of no use.
namespace ConsoleApplication5 { abstract class Car //abstract class { public abstract void Start(); public abstract void Stop(); } class Program:Car { //Overriding abstract methods public override void Start() { Console.WriteLine("Car has started"); } public override void Stop() { Console.WriteLine("Car has stopped"); } public void ApplyBrakes() { Console.WriteLine("Brakes have been applied"); } static void Main(string[] args) { Program obj = new Program();//Instantiating Program class //Calling abstract methods obj.Start(); obj.ApplyBrakes(); obj.Stop(); Console.ReadLine(); } } }
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Abstraction is showing the working of the machine but not the internal parts of the machine or the complexity of the machine. An abstract class cannot be instantiated. Only abstract methods can be declared in an abstract class which is necessary for the class, without them the class is of no use.