If class D is derived from a base class B
Answer / Somendra Pandey
When class D is derived from a base class B, it inherits all the members (functions and variables) of the base class B. Additionally, you can add new members to the derived class D.nnFor example:nn```cppn#include <iostream>nnclass Base {npublic:n void sayHello() const {n std::cout << "Hello, I am a base class!";n }n};nnclass Derived : public Base {npublic:n void addSomething() {n std::cout << " and I am adding something!";n }n};nnint main() {n Derived d;n d.sayHello();n d.addSomething();n return 0;n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
What is Boyce Codd Normal form?
Can we call C++ OOPS? and Why
What is a virtual function in C++?
What are issues if we mix new and free in C++?
What do you know about Volatile keyword in C++? Explain with an example code.
How to invoke a C function using a C++ program?
Explain what happens when an exception is thrown in C++.
What is the difference between public, private, and protected inheritance?
Explain why C++ is not purely Object Oriented Language
What does it mean to declare a member function as static in C++?
Explain the operator overloading feature in C++ ?
What is the meaning of the following declaration: int *const *const *i?