Chapter 6 Flashcards
What is namespace
Let say we make a class. And if we want to make another class with same name then namespace address this problems of ours. It use is like this using System;
Can namespace hierarchical
Yes
How we declare namespace
namespace csharp_station {}
Does destructor and constructor have any return type
No. We can not have return type on destructor because of garbage collection
Can we make constructor with arguments
Yes
Can we make destructor with arguments
No
Does C# provide default constructor and what is default constructor
Yes. Default constructor is when we do not make constructor then C# automatically creates constructor.
What is static constructor
It invokes when a class first time loads. It does not have return type and does not have parameters.
How many desctructors a class have
1
How we derive a class from base class
ChildClass : ParentClass
What constructor call first in inheritance
Parent class constructor first and then child class
What is virtual keyword
When we use virtual keyword to a method then we tell that we want to use that method polymorphically. It means a method invokes where ever base or in derive. Virtual will call method from its original type, from where it originally declared either base or derived.