Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
0
votes
0answers
12 views
OOP Design - Possible wrong approach makes it impossible to implement it in code
This last semester i've had lectures about OOP design, i understood most of what i was supposed to
but there is something that i can't get right.
I'm pretty sure that the models i create are wrong ...
0
votes
2answers
20 views
Generics and Comparable and Comparator… Syntax error, insert “;” to complete LocalVariableDeclarationStatement"
This question deals with generics and using the Comparable and Comparator interfaces.
I have a class Chocolate:
public class Chocolate implements Comparable<Chocolate> {
public int ...
1
vote
3answers
33 views
OOP concept: is it possible to update the class of an instantiated object?
I am trying to write a simple program that should allow a user to save and display sets of heterogeneous, but somehow related data. For clarity sake, I will use a representative example of vehicles. ...
0
votes
1answer
17 views
Progress bar in multiple dialogs with thread
My application has to keep track of time and alert user at different stages to allow or not allow certain actions. Because the user will be waiting, I want to show a progress to show wait time. For ...
0
votes
1answer
43 views
interitance and association modelling, how to do it?
I want to model the following situation in Java, but I am stuck:
Specifically the part related to Customer, Booking, Flight Booking and Bus Booking. I would like to have an array of Customer ...
0
votes
0answers
32 views
Weird behaviour of PHP 5.4 when extending a class, can anyone explain this?
I have a class which extend a class
class Ai1ec_Database extends wpdb
{
...
}
the superclass wpdb has a constructor function
function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
...
0
votes
2answers
29 views
PHP Traversable type hint
I have a relatively simple function which uses a foreach
function foo($t) {
$result;
foreach($t as $val) {
$result = dosomething($result, $val);
}
return $result;
}
I ...
-3
votes
1answer
83 views
Programming Monopoly in Python
I've been teaching myself Python over the last few weeks and am looking into tackling a rather ambitious project: writing the Monopoly board game in Python (text-based, I'm not ready for graphics work ...
-2
votes
1answer
48 views
Why this Object literal pattern is not working, accessing the methods through this
https://gist.github.com/Eurial/5751297
*
I get this error message
Uncaught TypeError: Object #<Object> has no method 'changePage' index_html.js:33
$.ajax.success index_html.js:33
...
0
votes
2answers
72 views
Python2.7: infinite loop when super __init__ creates an instance of it's own subclass
I have the sense that this must be kind of a dumb question—nub here. So I'm open to an answer of the sort "This is ass-backwards, don't do it, please try this: [proper way]".
I'm using Python 2.7.5.
...
0
votes
0answers
24 views
find a Object-Oriented Programming (OOP) open source project [closed]
I want to find an open source project, something not very extreme, to make small diagrams
like UML, sequence diagram and other...
Could you suggest me a project like that ?
I appreciate your help!
0
votes
5answers
87 views
Some design-pattern suggestions needed
C#. I have a base class called FileProcessor:
class FileProcessor {
public Path {get {return m_sPath;}}
public FileProcessor(string path)
{
m_sPath = path;
}
public ...
1
vote
8answers
90 views
Access private field of another object in same class
class Person
{
private BankAccount account;
Person(BankAccount account)
{
this.account = account;
}
public Person someMethod(Person person)
{
//Why accessing private ...
0
votes
1answer
35 views
Create Object from Subclass-Object
say I've got 2 Classes:
Class Foo
attr_accessor :bar
end
Class Baz < Foo
end
I'm creating an Instance of Foo and then want to have an Instance of Baz with the Data of the Foo Instance in ...
-4
votes
0answers
25 views
javascript render the player in specified div [closed]
I have a player class in Java, I want to implement similar functions in javascript.
I want to display the player in the specified location (target, DIV) with the following navigation calls.
How do I ...
1
vote
3answers
87 views
Java OOP concept
public class MyClass {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
From the above, if we say that MyClass is the class and public static void ...
0
votes
2answers
103 views
How to use same variable name for different classes
I'm trying to use a variable to instantiate different classes.
For example:
Object blah;
class1 ex1;
class2 ex2;
public void test(int i){
if(i == 1){
blah = new class1();
} else {
...
0
votes
2answers
30 views
Two different classes inherit from the same super class in Objective-C
I have a custom UITableViewHeaderFooterView class and a custom UITableViewCell class. These two classes share some methods and variables. I think it's better to create a super class for the shared ...
-3
votes
0answers
21 views
any good book that discusses only object oriented design/concepts [closed]
basically i'm looking for a good book(or guide) that only talks about object oriented concepts/design with out any programming language involved. I just want to know all the concepts of object ...
0
votes
1answer
20 views
Communication between two unrelated classes in rails?
I'm fairly new to rails and I've run into a scenario that I'm having trouble solving "the right way".
Let's say I have a few models:
Comment
Article
Photo
Video
Comments can be made on ...
0
votes
1answer
31 views
Thermostat to DB, OOP Design
I am attempting my first Java project (just started learning it/OOP). I have built a thermostat circuit that I can get the temperature from using a driver, and am now in the process of designing a ...
1
vote
2answers
57 views
Is there any standard way to implement an S4, foreach-compatible iterator in R?
I'd like to write custom iterators with in project. I can do this from scratch, but I prefer to do it the standard way, so the code would be easier to read by others. The iterators package, which ...
0
votes
1answer
67 views
Use undefined constants on purpose
So I have a project called WingStyle: https://github.com/IngwiePhoenix/WingStyle
It is yet in development, and i need something to make it a little smarter.
In a way I want to get away from some ...
1
vote
6answers
81 views
In c++, is it possible for a class to have an array that contains objects of another class?
For example, I have a class called Apple and another class called Basket and I want the class Basket to have a private attribute that is an array of Apple objects.
My code:
basket.h
#include ...
2
votes
2answers
60 views
How To Determine Aggregate Root - Domain Driven Design
I have an aggregate: User.
How will I determine its aggregate root?
cause i have:
+User(folder)
- User(Abstract Class)
* Administrator(Concrete inherits from User)
* ...
1
vote
3answers
55 views
How to share methods from other class
I tried to use protocol, but it needs to implement "makeMeDraggable" method for each 2 classes with the same content. I wish not to implement in each 2 classes and inherit implementation from Shared ...
0
votes
3answers
67 views
Is there a __equals method in PHP like there is in Java?
Is there a pattern or magic method you can use in PHP to define when to compare two instances of a class?
For example, in Java I could easily implement an __equals method and create a custom way of ...
0
votes
4answers
39 views
Inherit new 'instance' of a static field by deriving from base class [duplicate]
Consider following class hierarchy:
Base <-- Derived1
Base <-- Derived2
Base has got a static field.
I want the derived classes to inherit that static field but each class should have its own ...
0
votes
2answers
35 views
How to read file names and versions from XML file and add them into dictionary
I have a Xml file and file names and versions in file tags..... i want to read all file names and their corresponding versions and then want to add them into a dictionary
<application ...
1
vote
0answers
42 views
Dependency Contradiction in code generator
My current project is to attempt to port the popular card game Mao into a LAN game (multiplayer) where the computer will be the 'Grand Master.' It will keep track of the rules, the deck, the players, ...