Skip to main content

Posts

Showing posts from May, 2018

OOPS In C# | Abstract Classes, Abstract Method, Abstract Properties

abstract (C# Reference) The  abstract  modifier indicates that the thing being modified has a missing or incomplete implementation. The abstract modifier can be used with classes, methods, properties, indexers, and events. Use the  abstract  modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class. Example In this example, the class  Square  must provide an implementation of  Area  because it derives from  ShapesClass : C# Copy abstract class ShapesClass { abstract public int Area ( ) ; } class Square : ShapesClass { int side = 0 ; public Square ( int n ) { side = n; } // Area method is required to avoid // a compile-time error. public override int Area ( ) { return side * side; } static void Main ( ) {