Constructor Destructor Programming Exercises C#

In this chapter you will get exercise question. You must clear this problem using your programming techniques.
Qu 1 : Write a constructor destructor program in which you make 3 constructors. One is for default constructors with default message, next is parameterized constructor which accept a string value and last one is also parameterized constructor which accept two numerical value and shows add of them. Initialize all constructors and shows output.
Hint  
class Exercise
    {
        public Exercise()
        {
            //Your code here
        }
        public Exercise(string message)
        {
            //Your code here
        }
        public Exercise(int num1, int num2)
        {
            //Your Code here
        }
    }

Qu 2 : Use Destructor in the same program.

Summary

In this chapter you have cleared constructor destructor exercises and now you have sound knowledge of this area. In the next chapter we will learn the most important topic of C# is File Handling.

 

Share your thought