C# – How to Use Const in Inheritance

In this tutorial, you will learn to use const in Inheritance.

Programming Example

This example contains a class Laptop which inherits be base class LaptopBase. LaptopBase has several const values that are used in main method.

This program is showing different types of laptop with details. All the details are constant and cannot be changed.


  • Output

    Name : Lenovo
    Price : $1000
    Processor : i3
    Ram : 2GB
    HDD : 500GB

    *************************************

    Name : Dell
    Price : $1500
    Processor : i5
    Ram : 4GB
    HDD : 1TB

    *************************************

    Name : Sony
    Price : $2000
    Processor : i9
    Ram : 8GB
    HDD : 1TB

    *************************************
    _


    Leave a Reply

    Your email address will not be published. Required fields are marked *