Exercise: Python

Questions for: Inheritance

If a base class and a derived class each include a member function with the same name, the member function of the derived class will be called by an object of the derived class
A:
True
B:
False
C:
D:
Answer: A
This is because the member functions are always searched in the derived class and then in the base class.
If a base class contains a member function func(), and a derived class does not contain a function with this name, an object of the derived class cannot access func().
A:
True
B:
False
C:
D:
Answer: B
It depends upon how the function func() has been defined in the base class. If the function func() is defined public in base class then an object of the derived class can access the function func().
We can derive a class from a base class even if the base class's source code is not available.
A:
True
B:
False
C:
D:
Answer: A
We can derive from a base class even if it is present in an assembly.
There is no private or protected inheritance in C#.NET.
A:
True
B:
False
C:
D:
Answer: A
No answer description is available. Let's discuss.
The way a derived class member function can access base class public members, the base class member functions can access public member functions of derived class.
A:
True
B:
False
C:
D:
Answer: B
Base class cannot access derived class members since it does not have any knowledge of the derived class.
Ad Slot (Above Pagination)
Quiz