Hi,
I have this class model where, Bank is a class which is now going for computerized Banking network. This must have ATM(Automatic Teller Machine) and also Human Cashier.
I used Generalization and have taken a class called AccountHandlers which inherits Bank class. This AccountHandlers further have ATM and HumanCashier aggregated to ...
I wonder if can I say that a constructor is a special case of a method?
...
First thing to note - I KNOW DELEGATION AND DECORATOR PATTERNS!
Second - I am using C# .NET 4.0, so if you come up with a solution that is specific for it, that's fine. But if solution will work for any OOP language and platform, that would be great.
And here the question goes...
I have a partial class (lets name it Class1), which I c...
Can you provide scenarios when we inherit from a class, it works for a while, but then something else changes and introduces a bug?
I came up with the following situation:
to implement Rectangle-with-hole, we inherit from class Rectangle. In the constructor, we check that the hole is inside the rectangle
Later someone adds a new method...
Possible Duplicate:
Why are circular dependencies considered harmful?
I have a line object and a point object. A line has references to two points, and each point has a reference back to the line object it belongs to.
I have heard somewhere (I think) that circular references are a bad thing, but I don't understand why. Can s...
Hi guys
I was wondering the differences between abstract and interface in actionscript 3 and when to use them..I have searched google but still couldn't understand them....I hope someone here can give me few tips...Thanks a lot!!!
...
This is the code I'm using to pass the database handle to my class:
$db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($db->connect_error)
die('MySQL connection error (' . $db->connect_errno . ') ' . $db->connect_error);
$linkgen = new Linkgen($db);
echo $linkgen->getLinksLeft();
And this is the code in the Linkgen class:
...
My question is more about terminology then technicalities (or is it?).
What's the difference between a getter method and a public method in a class? Are they one in the same or is there a distinction between them?
I ask because I'm trying to learn best coding practices and this area seems grey to me. I was commenting my code out and n...
I have a mutable HashMap and would like to use it like a default-dictionary. The obvious method appears to be to use getOrElse and provide the default value each time as a second value. However this seems a little inelegant in my use case since the default value doesn't change.
var x = HashMap(1 -> "b", 2 -> "a", 3 -> "c")
println(x.ge...
Typically Composition and Aggregation are treated the same? But they are different and the choice which one to use changes a lot?
For e.g:
I believe aggregation would be ideal for testing. But composition is not.
Maintenance of dependencies is a pain while using aggregation but less using Composition.
So are there any similar views a...
I am curious as what else the new keyword does in the background apart from changing what the this scope refers too.
For example if we compare using the new keyword to make a function set properties and methods on an object to just making a function return a new object is there anything extra that the new object does?
And which is pref...
Can a class have virtual constructor??
If yes, why it is required?
...
I have a question which kind of applies to all languages with static typing and some sort of OOP.
If I have a class A, a class B which is a child of A, and a class C which is a child of B and a variable of the type A, can I store instances of B and C in it also?
...
Hi guys...
I was wondering how you guys decide when to use abstract or interface class during the application development since they both provide similar functionalities with slightly difference. I appreciate any helps. Thanks.
...
Im using multiple ASCX controls on one page, and the javascript clashes obviously if I use two of the same control. So Ive changed it all to proper OOP javascript so they dont interfere, but my problem now is how do I do the HTML side of things. Both ASCX's will make a div called "foo". So whats the usual way around this? Am I meant to a...
I am looking to learn OOP design and development. I would like to know if there are any real world tutorials out there (I googled but didnt find what I was looking for).
For example I am developing an inhome application (something like an HR application)
So I would have a person object, that would be inherited to become an employee, a...
I am developing a project in C++. I realised that my program is not OO.
I have a main.cpp, and several headers for different purposes. Each header is basically a collection of related functions with some global variables to retain data. I also have a windowing.h for managing windows. This contains the winMain() and winProc(). It calls t...
hi, i am trying to check whether the ship object is null, but i got an error message
Crane.cpp:18: error: could not convert ‘((Crane*)this)->Crane::ship.Ship::operator=(((const Ship&)(& Ship(0, std::basic_string, std::allocator >(((const char*)"arrive"), ((const std::allocator&)((const std::allocator*)(& std::allocator())))), std::ba...
I need to extend a class (in C++, but this question is language-agnostic I think), with functionality that can be implemented in two different ways:
by simply adding the logic to the class itself
by adding observer logic to the class and putting the logic in an observer, outside the class
There are advantages and disadvantages in bot...
A problem I have when developing PHP using OOP is that I'm never 100% sure on the best practices. I can read any number of tutorials and I understand all the "principles", like catching exceptions and how to build my classes, but I don't know how to integrate it all together properly.
I'm looking for some good quality open source applic...