Chapter 6 Flashcards

1
Q

What is namespace

A
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;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can namespace hierarchical

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How we declare namespace

A

namespace csharp_station {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Does destructor and constructor have any return type

A

No. We can not have return type on destructor because of garbage collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Can we make constructor with arguments

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can we make destructor with arguments

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Does C# provide default constructor and what is default constructor

A

Yes. Default constructor is when we do not make constructor then C# automatically creates constructor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is static constructor

A

It invokes when a class first time loads. It does not have return type and does not have parameters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How many desctructors a class have

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How we derive a class from base class

A

ChildClass : ParentClass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What constructor call first in inheritance

A

Parent class constructor first and then child class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is virtual keyword

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly