.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Abstract Classes and Methods

Posted By:SanthoshNathan       Posted Date: November 02, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

Abstract Classes and Methods

using System;

abstract public class MotorVehicle {
    public string make;
    public string model;

    public MotorVehicle(string make, string model) {
        this.make = make;
        this.model = model;
    abstract public void Accelerate();


public class Product : MotorVehicle {
    public Product(string make, string model:
        base(make, model) {
        // do nothing

    public override void Accelerate() {
        Console.WriteLine("In Product Accelerate() method");
        Console.WriteLine(model + " accelerating");

class MainClass {
    public static void Main() {
        Product myProduct = new Product("Toyota""MR2");


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend