Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Z-Adii OOPNew to Visual Studio Code? Get it now.
Z-Adii OOP

Z-Adii OOP

ADII

|
21 installs
| (0) | Free
A P
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Aadi OOP Snippets

A collection of beginner-friendly C++ and Java snippets for OOP, inheritance, operator overloading, templates, exception handling, and revision assignments.

Available Snippets

C++ Snippets

Shortcut Description
@A1-Encapsulation Encapsulation program
@A2-ArrayOfObjects Array of Objects
@A3-Constructor-Overloading&Destructor Constructor Overloading and Destructor
@A4-Function-Overloading Function Overloading
@A5-Student-Percentage Student Percentage
@A6-BankSystem Banking System
@A7-BankNo-Autoincrement Auto Increment Bank Accounts
@A8-Operator-Overloading Operator Overloading
@A9-ComplexNo-Add-Sub Complex Number Addition/Subtraction
@A10-Bank-Operator-Overloading Bank Operator Overloading
@A11-smartparking Smart Parking Management
@A12-Revision-Assignment Smart Banking and Loan Management
@A13-Employee-Hierarchy Employee Hierarchy
@A14-Vehicle-Fare Vehicle Fare Calculation
@A15-Vehicle-Interface Vehicle Interface
@A16-Exception-Handling Runtime Error Handling
@A17-Template Template Program

Java Snippets

Shortcut Description
@A18-Java-Constructor Even/Odd using Constructor
@A19-Java-Func-Overloading Function Overloading in Java

How to Use

  1. Install the extension
  2. Open a .cpp or .java file
  3. Type a snippet shortcut
  4. Navigate by arrow keys
  5. Press: Tab/Enter

B-Series Snippets (Exam Questions)

B1 — Book Records System

Write a C++ program to implement a class named Book with the following data members: Private: bookId, bookName, author, price. Public: getDetails(), printDetails(). The program should accept details of multiple books, display them in tabular form, and calculate the total price.

Shortcut: @B1-book-records-system


B2 — Student Records System

Write a C++ program to implement a class named Student with the following data members: Private: studentId, studentName, department, marks. Public: getDetails(), displayDetails(). Accept details of multiple students, display in tabular format, and calculate average marks.

Shortcut: @B2-student-records-system


B3 — Employee Payroll System

Write a C++ program to implement a class named Employee with the following data members: Private: empId, empName, designation, salary. Public: acceptData(), showData(). Accept details of multiple employees, display in table format, and calculate total salary expenditure.

Shortcut: @B3-employee-payroll-system


B4 — Book Constructor & Destructor

Write a C++/JAVA program to implement a class Book with suitable data members. Use constructors to initialize book details and a destructor to indicate object destruction, demonstrating objects, classes, constructors, and destructors.

Shortcut: @B4-book-constructor-destructor


B5 — Student Constructor & Destructor

Write a C++ program to implement a class named Student with suitable data members (roll number, name, marks). Use a parameterized constructor to initialize student details and a destructor to display a message when an object is destroyed.

Shortcut: @B5-student-constructor-destructor


B6 — Employee Constructor & Destructor

Write a C++/JAVA program to implement a class named Employee with suitable data members (employee ID, name, salary). Use a constructor to initialize employee information and a destructor to indicate when an object is removed from memory.

Shortcut: @B6-employee-constructor-destructor


B7 — BankAccount Static Members

Design and implement a C++ program to model a banking system where the class BankAccount keeps track of total accounts and total balance using static data members and static member functions. Also implement a member function to display two balances in ascending order.

Shortcut: @B7-bankaccount-static-members


B8 — Student Friend Function

Write a C++ program to create a Student class with private data members: Roll Number, Name, Marks of five subjects, Percentage, Division. Implement a friend function comparePercentage() that takes two Student objects and displays the one with the higher percentage.

Shortcut: @B8-student-friend-function


B9 — ParkingTicket Dynamic Allocation

Design and implement a C++ program for a ParkingTicket class with private data members (ticketNumber, vehicleNumber, parkingFee) and static members (totalTickets, totalCollection). Dynamically allocate objects using new, define a friend function compareFees() and release memory using delete.

Shortcut: @B9-parkingticket-dynamic-allocation


B10 — Complex Number (+, -, *)

Design a C++ class Complex with data members for real and imaginary parts. Provide default and parameterized constructors. Implement operator overloading for +, -, and * to perform arithmetic operations on complex numbers.

Shortcut: @B10-complex-number


B11 — Number Unary Minus

Create a class Number that stores an integer value. Provide member functions to input and display the value. Overload the unary minus operator (-) so that it returns a new object whose value is the negative of the original.

Shortcut: @B11-number-unary-minus


B12 — Integer Pre/Post Increment

Design a class Integer that stores an integer value. Overload both increment operators: Pre-increment (++obj) to increase the value and return the updated object, and Post-increment (obj++) to return the original value before incrementing.

Shortcut: @B12-integer-pre-post-increment


B13 — Employee Hierarchy Payslip

Design and implement a C++ program to demonstrate inheritance using an employee hierarchy. Base Class: Employee. Derived Classes: Programmer, TeamLead, AssistantProjectManager, ProjectManager. Each derived class calculates DA (52%), HRA (27%), PF (12%), Staff Club Fund (0.1%) of Basic Pay and generates a pay slip.

Shortcut: @B13-employee-hierarchy-payslip


B14 — Employee-Manager Single Inheritance

Design a C++ program using single inheritance. Base class Employee contains ID, name, basic salary. Derived class Manager adds a monthly bonus and calculates total salary (basic salary + bonus).

Shortcut: @B14-employee-manager-single-inheritance


B15 — Shape Triangle/Rectangle (Virtual)

Write a C++ program using a base class Shape with a protected data members x and y. Derive Triangle and Rectangle classes that override compute_area() as a pure virtual function. Demonstrate dynamic binding using a base class pointer.

Shortcut: @B15-shape-triangle-rectangle-virtual


B16 — Salary Calculation (Abstract)

Design a C++ program with a base class Employee having a pure virtual function calculate_salary(). Derive PermanentEmployee (salary = basicPay + allowance) and ContractEmployee (salary = basicPay only). Demonstrate runtime polymorphism.

Shortcut: @B16-salary-calculation-abstract


B17 — Electricity Bill System

Write a C++ program with a base class ElectricityBill having a pure virtual function calculate_bill(). Derive Domestic and Commercial classes. Commercial bill adds 10% surcharge. Demonstrate runtime polymorphism using a base class pointer.

Shortcut: @B17-electricity-bill-system


B18 — Vehicle Interface

Write a C++ program using an abstract base class Vehicle as an interface with pure virtual functions: gearChange(), speedUp(), applyBrakes(). Implement these in derived classes Bicycle, Bike, and Car.

Shortcut: @B18-vehicle-interface


B19 — Student Result Exception Handling

Write a C++ program to process student results. Accept marks for n subjects and calculate percentage and grade. Use exception handling: throw if number of subjects is 0 (division by zero) or if any marks are invalid (< 0 or > 100).

Shortcut: @B19-student-result-exception-handling


B20 — Employee Age Verification

Write a C++ program to register an employee. Accept name, age, and years of experience. Use exception handling to validate: age must be between 18 and 60, and experience must be non-negative.

Shortcut: @B20-employee-age-verification


B21 — AreaCalculator Overloading

Create a class AreaCalculator with overloaded methods area() to: Calculate area of a Square (int side), Rectangle (int length, int breadth), and Circle (float radius). Demonstrate compile-time polymorphism.

Shortcut: @B21-areacalculator-overloading


B22 — Calculator multiply Overloading

Create a class Calculator with overloaded methods multiply() to: Multiply two integers, multiply three integers, and multiply two double values. Demonstrate compile-time polymorphism by calling different versions.

Shortcut: @B22-calculator-multiply-overloading


B23 — Shape Perimeter (Java)

Design and implement a Java application to calculate the perimeter of Circle, Rectangle, and Triangle using hierarchical inheritance. Base class Shape defines perimeter(). Each derived class overrides it. Demonstrate runtime polymorphism using a base class reference.

Shortcut: @B23-shape-perimeter-java


B24 — Threads Even/Odd (Java)

Write a Java program to create two threads. One thread displays even numbers from 1 to 20 (using Thread class), and the other displays odd numbers from 1 to 20 (using Runnable interface).

Shortcut: @B24-threads-even-odd-java


B25 — Threads Even/Div-by-5 (Java)

Write a Java program to create two threads. One thread displays even numbers between 1 and 50, and the other displays numbers divisible by 5 between 1 and 50. Both use the Thread class.

Shortcut: @B25-threads-even-div-by-5-java


B26 — Shape Area (Java)

Design and implement a Java application to calculate the area of Circle, Rectangle, and Triangle using hierarchical inheritance. Base class Shape defines area(). Each derived class overrides it. Demonstrate runtime polymorphism using a base class reference.

Shortcut: @B26-shape-area-java

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft