Category "oop"

How do I prevent the input of a number like 2.2.2 in my calculator?

I have been working on a simple JS calculator using an OOP approach. I am struggling to create a fix that prevents the input of extra decimals. For example, a u

How do I prevent the input of a number like 2.2.2 in my calculator?

I have been working on a simple JS calculator using an OOP approach. I am struggling to create a fix that prevents the input of extra decimals. For example, a u

enforcement for abstract properties in python3

I have this abstract class class Kuku(ABC): def __init__(self): self.a = 4 @property @abstractmethod def kaka(self): pass

Call Private methods outside class definition

I'm trying to use a Gem that provides me with a DSL i need to apply on some of my classes. But using it directly makes my class definitions not as clean as i wa

Typescript error: An outer value of 'this' is shadowed by this container

I had an error in a Typescript class method declaration, but I don't understand how the error message relates back to the bug. The message seems to be saying

Must be of the type array, null given,

I keep getting the following error and I'm not to sure why: Catchable fatal error: Argument 3 passed to System\Loader::action() must be of the type array, nul

integrating clean architecture with ORM

I'm trying to develop a monolithic Django application with Uncle Bob's clean architecture. The problem is I don't want to miss the powerful abilities of Django

How can subprocess be used in a class and tested in python

I have an executable that has many options and I wish to create classes. e.g. the exec has options that can copy rows of a file, rename parts of a file, compres

LateBinding with dynamic memory

I have Base and Derive class at the below which related to polymorphism (Latebinding) : class Base { .... }; class Derive:public Base { .... }; int main() {

__init__() missing 1 required positional argument it reads self as a parameter

I'm new at programming and I'm learning Python. The code should be very simple. The goal should be implement a calculator that does additions between numbers. I

How can I extend a 3rd party Javascript object using typescript

I've been trying to figure out how to do this most of the after noon, and I'm either not getting something, or I'm approaching things wrong. I'm currently worki

Python circular imports with inheritance

I have a parent and child class, where a parent's method returns an instance of the child. Both classes are in separate files classA.py and classB.py. In order

What is the importance of object oriented programming for competitive programming?

right now i am learning c++ and oop in c++.I usually practice on Codeforces,but i didn't get any use of object oriented programming for solving any problems.So

What does dependency/dependant mean?

http://tutorials.jenkov.com/ood/understanding-dependencies.html#whatis says that (emphasis mine): Whenever a class A uses another class or interface B, then

In Dart, is it possible to pass an argument in a singleton?

class Peoples { late int id; late String name; static final Peoples _inst = Peoples._internal(); Peoples._internal(); factory Peoples() { retur

When are static variables initialized in Python?

Consider the following code class Foo: i = 1 # initialization def __init__(self): self.i += 1 t = Foo() print(t.i) When exactly does the ini

Where is the Balance Between Dependency Injection and Abstraction?

Many Architects and Engineers recommend Dependency Injection and other Inversion of Control patterns as a way to improve the testability of your code. There's n

Convert UDT subtype to supertype

I use a user-defined type (UDT) in Oracle 18c called ST_GEOMETRY: The ST_Geometry storage type ST_Geometry in Oracle SQL functions used with ST_Geometry I have

Friend function inside class and outside class, what difference does it make?

#include<iostream.h> #include<conio.h> class time { private: int dd,mm,yy; public: friend istream & operator >>(is

Copy child object to parent object

I have three classes: Shape, Rectangle and Circle. Shape is parent of two other class. definition of this classes is in following code: #include <iostream>