Code:class B { public: virtual void display() { cout << “No function display defined in this class\n”; }; class D: B {}; void main() { D d; d.display(); }
Whts the error in above code ??
:-((
This is a discussion on Error ? within the C++ Programming forums, part of the General Programming Boards category; Code: class B { public: virtual void display() { cout << “No function display defined in this class\n”; }; class ...
Code:class B { public: virtual void display() { cout << “No function display defined in this class\n”; }; class D: B {}; void main() { D d; d.display(); }
Whts the error in above code ??
:-((
Change D to a struct.
Code:class D: B {}; to class struct B {};
??
We're not human compilers. At least make an honest effort before asking us questions. What you posted has a number of mistakes and issues, and it indicates you have no clue what you're doing. Don't dump garbage code at us without giving us anything to go on.
Here's a free pass:
Go learn to code for real, and make sure you're not lazy about it. We're willing to help, of course, but if you don't have a good foundation in something, we can't point you in the right direction. That requires you to learn.Code:#include <iostream> class B { public: virtual void display() { std::cout << "No function display defined in this class\n"; } }; class D : public B { }; int main() { D d; d.display(); }