573 questions
1
vote
1
answer
90
views
Address of 'this' pointer in Inheritance hierarchy
I was debugging some legacy code and while doing that found some inconsistency in the address of this pointer in the class hierarchy like this:
#include <cstdio>
#include <vector>
class ...
2
votes
3
answers
936
views
On which side shall I put the diamond sign in an UML diagram
I am trying to figure out where should the diamond be placed in this example, I understand its a has-a relationship and diamond should be placed to indicate the whole and part relationship.
I have ...
-2
votes
1
answer
42
views
Is there a way to access a variable from a acctual CHILD class?
ps: I dont want to acess a parent class var but rather an actual child class
How do I access the $table var from User class? I know it sounds silly but is there a way to access this child class var ...
0
votes
1
answer
71
views
What is the optimal way to manage the creation of objects of the same type that only differ in the values of their fields? [closed]
I have encountered this scenario several times but I couldn't find a definitive answer on the optimal way to manage it.
Here's the issue. I have a Java 21 backend application that provides a React app ...
-1
votes
1
answer
61
views
Abstraction vs Encapsulation , not the bookish definition , real world examples
I have searched about this topic everywhere that what's the difference between abstraction and encapsulation
, even one of the most voted stack overflow question , but at the end it seems confusing
...
1
vote
1
answer
77
views
Python: trace all previous call stack of a library for debug purpose
Is there any elegant and easy way to trace all the call stacks in Python of a library for debugging or code understanding purposes?
Suppose there is a very big huge library that I'm importing and need ...
1
vote
1
answer
140
views
Where should I locate an Event Listener? Basics of OOP
After a few years I'm trying to get back to programming and therefore i am trying to programm a relatively simple app in android studio.
Im still at the part of thinking how the programm should be ...
0
votes
1
answer
322
views
object-oriented programming architecture with database access design
With object-oriented programming in mind, how does the database come into play with objects? Like for example, let's say there is a Student class, with attributes like name, number, courses, etc
The ...
0
votes
1
answer
43
views
Declaring and initializing object of type child class in its base class
What's the name of the code smell committed by the following code. I try to google around to find the de-facto name of the following code smell to no avail.
The reason why I'm searching for it is ...
0
votes
1
answer
38
views
Resolve code duplication using Generics VS Inheritance
I have a common reader for three different classes, but there is some code duplication because the reader has different methods for each of the classes A, B, and C. Is there anyway I can make the code ...
0
votes
2
answers
907
views
Why is the 'Public' keyword not being recognized"?
I am new to Salesforce Development/Apex and am running practice exercises.
When I run this code thru the 'Anonymous Apex' window, it throws an error reading:
"Unexpected token 'Public'. "
...
1
vote
1
answer
74
views
Selenium Pagination
I am trying to get all links with pagination. I am using selenium. Since there is more than ten thousand data, it will take time to get all links and some informations in it. I want to use pagination. ...
2
votes
1
answer
100
views
Declaring object classes in C?
I declared a few geometric figures types such as:
typedef struct s_sphere{
t_tuple origin;
double radius;
} t_sphere;
typedef struct s_cylinder{
t_tuple origin;
double height;
...
1
vote
1
answer
417
views
Features and Use Case Diagrams Vs Requirements and Use Cases
According to "Head First Object-Oriented Analysis and Design", Complex projects involves first finding a feature list -> drawing use case diagrams -> breaking into smaller modules ...
0
votes
0
answers
30
views
Speed type tester - how to reference variables out of scope?
I am relatively new to python and I am struggling with building this speed type tester, I am not sure as to why I can seem to change the value of ''time_over'' from false to true in the first function,...
0
votes
1
answer
177
views
TypeError: 'str' object is not callable when I was changing instance attribute
class Airport:
def __init__(self, code, city, country):
self._code=code
self._city=city
self._country=country
def __repr__(self):
return "%s(%s,%s)"%(...
0
votes
0
answers
89
views
Matlab-Error-Variable might be used before it is defined
enter image description hereI have defined some classes and two of them Called "Global" &"GlobalFlag".
All the classes are in one folder and same path.
But in another related ...
0
votes
0
answers
27
views
Access class parents attributes from a class child
so i have a class phone where we find the attributes : brand --> str, model--> datetime, price--> float, quantity: int
this is my code so far
the class parent
from datetime import datetime
...
0
votes
1
answer
284
views
Labels(tkinter) in python, how can I update the value of a Label and then display it, without showing the previous values of that label?
So, I have this code, and it calculates an OTP(value) each time I click on Button(OTP), and that value is showed on myLabel. However, when it is displayed the values are getting accumulated, E.g. if I ...
0
votes
0
answers
78
views
Calling a function of the derived class from a variable type of parent class [duplicate]
I am learning Object Oriented Programming. I wrote the following simple program, but I don't follow why the call b->derived_function(); doesn't work. I understand the base class Base does not ...
4
votes
2
answers
205
views
Best Practice for OOP function with multiple possible control flows
In my project, I have this special function that does needs to evaluate the following:
State -- represented by an enum -- and there are about 6 different states
Left Argument
Right Argument
Left and ...
0
votes
0
answers
49
views
JAVA-Assertion fails even expected output seems to be matching with the actual output. Please help me out with the possible solutions
This is the result of Integration testing!
Message:
N/A
Stack trace:
org.opentest4j.AssertionFailedError: expected: <Songs Loaded successfully
1 Kiran
Playlist ID - 1
Playlist ID - 2
Delete ...
0
votes
0
answers
55
views
Is there a way of avoding diamond kind problems this OO Design
I have an event processing use case where I am using templates for various kinds of logic involved during event processing e.g transaction handling, processing template based on events e.g update, ...
0
votes
0
answers
70
views
Questions about Java OOP(Inheritence)
I am trying to make a videogame that is similar to "Turing Complete". In this game you are supposed to connect circuit pieces to create a computer by the end. So I have a question on ...
-1
votes
1
answer
52
views
I am getting null as outcome ? Could anyone catch and rectify for the same Thanks
This method I created
public class Use {
private
String firstname;
String lastname;
public String output() {
return "Hii my name is " + firstname + ...