C# Inheritance Programming Questions

In this chapter you will learn to solve inheritance problem using codes. There are some programming question are there that you have to solve.

Qu 1: You are assigning to develop a project in which you have to achieve following goals.

  1. Write a program for creating Laptop.
  2. Name, Price, Processor, Ram and Hard drive should be defined in base class as constant.
  3. You need to inherit these functionalities in your program and Print Details.
  4. All the laptop should have different name, price, processor, ram and hard drive.
 

Your output should be like this

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

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

Summary

In this programming Exercise you learned how to use constant value in inheritance. In the next chapter, you will learn Delegates and Events.

 

Share your thought