Created
November 24, 2021 05:35
-
-
Save rozer007/5ede582ab239fece810f522c85f0f9b1 to your computer and use it in GitHub Desktop.
Inheritanec in c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the need of inheritance? | |
Ans- We use inheritance because it provides us code reusability and reduces our code. It also reduces data redundancy and duplicacy. | |
2. Does C# supoorts multiple inheritance? | |
Ans- No C# only doesn't support multiple inheritance but we can use modules to implement multiple inheritance. | |
3. How can we create a method to override the method in base class | |
ans: we will use the new keyword use the function name while declaring a function for overriding. | |
4. How can we called the superclass constructor in a base class. | |
ans: We will use base() function to called the constructor of the base class | |
eg. constructor():base() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Which symbol is used to inherit a class in c#? | |
a. extends | |
b. : | |
c. < | |
d. None of the above | |
Ans b | |
2. C# supports multiple class inheritance? | |
a. True | |
b. False | |
Ans b | |
3. We can overwrite parent class methods in our child class? | |
a. True | |
b. False | |
Ans a | |
4.What is called as the data hiding ? | |
a. method overloading | |
b. inheritance | |
c. method overriding | |
d. none of the above | |
ans c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment