Question
The following C++ code has a compilation error. How can you correct it to properly use the abstract base class `Printer`? #include class Printer { public: virtual void print() = 0; }; class LaserPrinter : public Printer { public: void print() { std::cout << "Printing with LaserPrinter" << std::endl; } }; int main() { Printer* p = new LaserPrinter(); p->print(); delete p; return 0; }
More IT Operating System Questions
- Stack is sometimes called as :
- Which data structure is most commonly used to efficiently implement a priority queue?
- Which statement correctly distinguishes a container from a traditional Virtual Machine (VM)?
- .Consider the following Java code: class Shape { void draw() { System.out.println("Drawing a generic shape"); } } class Circle extend...
- In a bank's IT governance framework, which statement correctly describes the relationship between a Business Continuity Plan (BCP) and a Disaster Recovery ...
- Consider the Quick Sort algorithm with the last element as the pivot. For the array [7, 2, 1, 6, 8, 5, 3, 4], what will be the state of the array *after th...
- Which of the following statements accurately describes the object-oriented programming (OOP) support in Java and C?
- Complete the Java method to extract a substring from text starting at startIndex and having length characters. public class StringUtil { public Strin...
- The transfer function of the system below is ___________
- Given a table Transactions(txn_id, account_id, amount, txn_date), which query correctly finds accounts that made more than 3 transactions on the same singl...
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)