Database-Management-System
November 5, 2023Question 1232 – Nielit STA [02-12-2018]
November 5, 2023OOPS
Question 109
|
The design of a class in C++ which can’t be inherited is achieved using ___ keyword before class declaration.
Final
|
|
Static
|
|
Sealed
|
|
Fixed
|
Question 109 Explanation:
→ Final is a non-access modifier applicable only to a variable, a method or a class.
→ Final variable are used to create constant variables
→ Final methods are used to prevent method overriding
→ Final Classes are prevent inheritance
→ We make the Final class non-inheritable. When a class Derived tries to inherit from it, we get compilation error.
→ Final variable are used to create constant variables
→ Final methods are used to prevent method overriding
→ Final Classes are prevent inheritance
→ We make the Final class non-inheritable. When a class Derived tries to inherit from it, we get compilation error.
Correct Answer: A
Question 109 Explanation:
→ Final is a non-access modifier applicable only to a variable, a method or a class.
→ Final variable are used to create constant variables
→ Final methods are used to prevent method overriding
→ Final Classes are prevent inheritance
→ We make the Final class non-inheritable. When a class Derived tries to inherit from it, we get compilation error.
→ Final variable are used to create constant variables
→ Final methods are used to prevent method overriding
→ Final Classes are prevent inheritance
→ We make the Final class non-inheritable. When a class Derived tries to inherit from it, we get compilation error.
Subscribe
Login
0 Comments