Questions tagged [object-oriented]

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

Filter by
Sorted by
Tagged with
5
votes
3answers
1k views

C++ basic bank money class

I am trying to create a basic money class that fits into a small console banking application I am making. Money.h ...
-1
votes
0answers
18 views

Vue JS - Error : Property 'xxxx' does not exist on type <component-name> [closed]

I'm new to vue, So, to describe my work: I implemented a form and bound it to the data() hooks to retrieve the data from the from, and then onSubmit() I create an object newClass{} and $emit it to ...
0
votes
1answer
54 views

Composition and lazy evaluation: is the composite class properly designed? [closed]

Let's consider the following assumptions: The Python programming language is used. One composite class is implemented. There are two or more component classes implemented. For instance, the composite ...
1
vote
2answers
96 views

Is my Tic-Tac-Toe design clean?

The following is an implementation of Tic-Tac-Toe game. I tried to incorporate S and O principles without violating ...
2
votes
1answer
63 views

PHP OOP: Configuring MySQL DB & query w/ Twig

I decided to up my PHP game and learn some OOP. I am re-building my website from procedural to OOP, but since I don't want to use a full framework I fiddle with some components. As a router I use ...
0
votes
1answer
34 views

Advent of Code 2021 Day 4: Play Bingo against a Giant Squid

[This is my first post here - though I have been lurking in the back reading, plussing, and hopefully learning for over two years] Below is my solution for Advent of Code 2021 Day 4, where you are ...
0
votes
0answers
10 views

Good practice to structure a react code capable to connect to different devices

I am writing a "simulation" tool for my app where I can define a device (like IoT device/gateway device/server etc) and choose the type from which I want to receive data (Bluetooth/serial ...
2
votes
1answer
99 views

red black tree implementation in cpp

I am learning algorithms and trying to implement them in c++, I have chosen to try to implement a red-black tree due to its self-balancing properties and its ability to stop the worst case of O(n) ...
4
votes
3answers
492 views

C++ money class for basic banking application

I wanted to get my code reviewed as I have tried to implement a basic Money class to represent money values in c++. Can anyone tell me if I am implementing my basic arithmetic operator overloads ...
0
votes
2answers
102 views

c++ Most clean way to implement duplicate Binary Search Tree for complex type

I have tried to make my own implementation for a BST task I was given for a complex type (Transaction), that should be able to store duplicate values as well. However, I am not sure if I have gone ...
1
vote
0answers
25 views

AutoBind TypeScript decorator

Idea is to have an AutoBind decorator which you could append in front of any method to have it preserve its own this, instead of manually binding it when called. <...
0
votes
0answers
14 views

Object orientated hitbox overlap

An object named objStupid calls the script object_createHitbox to initialize some basic variables(x, y, width, height). Next, it ...
0
votes
0answers
51 views

Stock Exchange Low Level Design

I'm new to LLD. Just started practicing it. Please review my code below and give me suggestions to improve. Models ...
4
votes
2answers
80 views

UNO card game with AI players

I had lost a lot of cards of my UNO deck, and was frustrated, and that's when this idea struck my mind. I chose C++, knowing it would be hard, just to improve my understanding of the language. ...
0
votes
3answers
78 views

Object-Oriented Hangman In Python [Follow-Up]

This is a follow up after revisions made from this question. I've separated the program into 2 classes. The HangManData class is used to store game data such as the ...
4
votes
2answers
274 views

Simple console application to practice OOP and file layout

I am not used to work with OOP so I decided to make a simple console "walk" game to focus on the OOP and the general game design process. I tried to make it as robust as possible but I feel ...
-2
votes
0answers
18 views

Why does sys.exit() subtract the total? [migrated]

I have a task at hand to write a program to calculate the sum of numbers. This is a beginner python program. I have found two solutions for this exercise in which one is working perfectly well and ...
4
votes
1answer
75 views

Objected-Oriented Hangman game In Python

I'm still a beginner in python and made this simple program to practice OOP, I've ended up using the self keyword a lot and I'm not sure if this is normal or if I ...
3
votes
1answer
109 views

C++ bond mathematics calculator

I have written a program in C++ that processes financial bond mathematics, making extensive use of the valarray class, so that mathematical functions and operations ...
0
votes
1answer
24 views

interface different usages issue for two or more different implementations

I am writing a small micro-service in typescript with NestJS. This microservice is responsible of giving a user access to one of our company's systems trial access. At first I used hubspot integration ...
10
votes
6answers
2k views

Console Library System in C++

I'm a beginner and came up with this simple project in C++. Any feedback would be very much appreciated. GitHub Repo Note: I'm using a file called "db.txt" as a database. main.cpp ...
5
votes
1answer
82 views

Space Invaders clone for a college project

Edit: the project was submitted, and I got a good grade! :D I am finishing up a project for my computer science class. The project is a space invaders clone that uses the JavaFX library to provide ...
2
votes
0answers
48 views

SQLite C/ADO VBA library with reflection

SQLite C/ADO VBA library with reflection The SQLiteCAdo library is a VBA middleware facilitating access to SQLite databases. Its two subpackages provide alternative connectivity options: via ADODB/...
6
votes
1answer
213 views

Hot Dog Cookout Calculator

Hiii... Can you please check the code and see whether I might have done a mistake ? Beginner's eyes can be misleading quite easily. I feel like there's something wrong in this solution. I can't ...
0
votes
3answers
108 views

A Class that creates a unit of Stock or a collection of Stocks

I have a dataclass of a single class object 'AStock' as such: ...
0
votes
3answers
90 views

The bulls and cows game

I have implemented the bulls and cows game in C++. The code: ...
0
votes
0answers
54 views

Object Oriented Routing using Python's FastAPI

I created a BaseRoute class route handling. The BaseRoute class takes the following parameters: ...
1
vote
0answers
40 views

Resolving circular references in VBA via ObjectStore class and CleanUp cascade

Resolving circular references in VBA via ObjectStore class and CleanUp cascade I have been working on a VBA database library and realized I had a few circular reference loops in my class hierarchy, as ...
1
vote
1answer
68 views

Predeclared class instance tracks the number of regular instances

Predeclared class instance tracks the number of regular instances In VBA, predeclared class instances can act as object factories, and in general, it makes sense to keep this instance stateless. ...
3
votes
2answers
151 views

TicTacToe Objects calisthenics OOP

I'm learning Objects calisthenics and I was practicing with the typical Tic Tac Toe game, I was wondering if you could gimme feedback about my mistakes (Algorithmic problems, logic, and especially OOP ...
14
votes
4answers
1k views

Numerical integration in C++: Newton-Cotes formulas

I have tried my hand with implementing simple quadrature formulas in C++. Definite integral: $$\int_a^b f(x) dx$$ Domain of integration \$[a, b]\$ divided into \$n\$ intervals of equal length \$h = (b ...
2
votes
2answers
86 views

Fractions in C++

I started learning classes and operator overloading in C++. To test my skills I decided to make a Fraction class with all necessary operations. I would appreciate improvements and suggesstions on my ...
2
votes
2answers
67 views

Setting instance variable for salary bonus based on academic position

I have a class Scholar which is basically a teacher in a university. I have to calculate the yearly salary of a scholar instance where the formula is ...
2
votes
1answer
88 views

Evaluating postfix expression on multidigit numbers

This is my solution for evaluating postfix expression using a stack. It does work on multidigit numbers, the problem I was struggling with last time. Now it works completely fine. This is the stack ...
10
votes
2answers
2k views

Is my PHP login system following best practices? Is the code really OOP?

I'm learning about OOP and putting my knowledge into practice. I created a login system in PHP, so I wish someone could tell me if I'm on the right track. I feel like I'm getting better at coding, but ...
2
votes
1answer
89 views

Simple Lagrange interpolation

I wrote a Lagrange polynomial interpolation class. It works fine. At the beginning some definitions: $$ \begin{align} &nodes:\qquad x_0, \dots, x_n \\ &values:\qquad f(x_0), \dots, f(x_n) \\ &...
1
vote
2answers
113 views

Card deck for Blackjack in an OOP style [closed]

So far I have made a class called Deck, to create and shuffle a deck of cards, and a class called Player, which I want to use to create the gambler and the dealer. My Player class inherits from the ...
0
votes
0answers
37 views

Implementing a programming language with objected-oriented programming in EcmaScript 6

I am trying to implement the Dis language as a webpage in order to reproduce Dis programs for code golfing easily on browser. Since a famous online environment tio.run is not accepting new languages, ...
2
votes
0answers
78 views

Android nested RecyclerView handling clicks, using OOP

Brief Background: I just started learning Android Development recently. I have some experience with programming and understand the basics of OOP but am not confident that I am using principles of OOP ...
0
votes
1answer
42 views

React code that controls user permissions

I have this code that controls the user permissions provided to a user. In my case, I constructed a simple example of CRUD. When the admin checks the boxes, it will grant the user access to perform ...
0
votes
1answer
35 views

Stream that computes running median value

I was solving a DSA question, running median in a stream. And I decided to design my own stream class with additional features. ...
7
votes
7answers
3k views

DnD Die in Java with regex

For my game I need to roll some values with a die. A die is formally described as: nDs[+a] n amount of die (optional, 1 of not set, zero must be set explicitly) D ...
4
votes
1answer
102 views

Code to scan filesystem, store every path into sqlite and update only when something has changed

I have made a program that does what the title explains. It also hashes the file to check for changes. I will be doing this for a project to keep track of files that has been changed when doing ...
9
votes
1answer
211 views

Minesweeper implementation java

I'm writing Minesweeper implementation in Java. I have little experience yet, so I need some advices: about improving code, making it more readable and flexible about coding style about common ...
4
votes
0answers
88 views

Sudoku sequence solver for non-standard constraints

This script is designed to help solve sequences in Sudoku puzzles with variant constraints (ex: Thermometer, Renban, etc.). Summary The user specifies the constraints they want applied as well as the ...
6
votes
2answers
210 views

ASCII-based OOP blackjack game in Python

I'm new to programming and have been teaching myself to code for about 6 months. Since I have no one to ask about any of coding-related questions, I may have developed bad habits in the meantime, but ...
1
vote
1answer
87 views

Model animals using inheritance in Java

I was assigned the following problem: You've gone back in time to 500BC Athens and Socrates wants you to build him an app to help classify animals. Build the classes ...
3
votes
2answers
73 views

Finding Number of Objects in Image

I wrote a program that, given a 2D array representing pixels in a birds eye view image, it returns the number of Objects in the image. Pixels that are connected in the up, down, left, and right ...
2
votes
0answers
75 views

Arcade Stacker Game - Core Logic

This is my first post here, so I apologize if anything is incorrect. I have created an endless arcade stacker game (like the stacker games at the arcade, but when you hit the top the grid resets and ...
0
votes
2answers
84 views

Separating odd numbers and even numbers into two vectors in C++

I'm learning C++, and would like some guidance. I'm pretty sure I'm doing something wrong. This algorithm runs in O(n) time and uses O(n) external space. Could I make a more efficient algorithm for ...

1
2 3 4 5
74