When I wrap up some procedural code in a class (in my case c++, but that is probably not of interest here) I'm often confused about the best way to do it. With procedural code I mean something that you could easily put in an procedure and where you use the surrounding object mainly for clarity and ease of use (error handling, logging, tr...
Possible Duplicate:
Book recommendation for learning good PHP OOP?
Hey guys, I've been reading a couple of books about Object Oriented PHP, and I have noticed that most of the examples used refer to real life objects like Dogs etc. Does anybody know of a book that can use the concepts in real coding examples and explain it in ...
We are designing a system and one of our requirements is to be able to record various events which are enacted on our domain entities as they pass through their lifecycle. A bit of me thinks we should store all these events as "Command" pattern objects with associated metadata (actor, date/time etc.) but this is based on my having used i...
Our company keeps a MiscUtilities class that consists solely of public static methods that do often unrelated tasks like converting dates from String to Calendar and writing ArrayLists to files. We refer to it in other classes and find it pretty convenient. However, I've seen that sort of Utilities class derided on TheDailyWTF. I'm just ...
ASP.NET MVC has come a long way (compared to webforms) in becoming a unit testable framework. However, we are often faced with some remaining pigs like FormsAuthentication, which I usually wrap in some type of UserSession object to keep it clean and testable. The other day I realized I was using Server.MapPath in my controller action, an...
You can actually just skip this first part cause it gets confusing, but I'll keep it here cause I want to know if anyone else feels the same way. I am a CS undergrad who has have been using Java for 3 years, and I still find it difficult to comprehend how to include the Main function into my design. It feels wrong to place it in a class ...
I have a class that looks like this:
class Base
{
public:
Base( int val = 0 ) : value( val ) {};
int value;
};
Classes A and B inherit Base:
class A : public Base {};
class B : public Base {};
I also have a templated class with a signature similar to:
template < class T >
class Temp
{
public:
...
I'm struggling to make a flexible data structure (like a relational database) for a quiz in ActionScript 3.0.
I have a number of questions, each with 2 alternatives:
Questions
| id | alt1 | alt2 | correctAlt |
---------------------------------------
| 0 | Sweden | Denmark | 1 |
| 1 | Norway | Finland | 2 |...
Is there a way to get the instance's class name with VB.NET?
...
Hi, I have a parent class (Foo) with shared methods. It is MustInherit.
Bar and Baz classes inherits from Foo. I will do something like that:
Dim baz as New Baz()
Dim bar as New Bar()
baz.sharedMethod()
bar.sharedMethod()
Within of Foo's sharedMethod(), I need to know who (class name) called it. So, using the above example, it would ...
interface I1 { ... }
interface I2 { ... }
struct List(T) { ... }
How do I specialize my List to operate only on classes that implement both I1 and I2? One interface is easy:
struct List(T : I1)
Other languages. In C# it's:
struct List<T> where T : I1, I2
And in Java I'd say:
class List<T extends I1 & I2>
One catch: I don't wan...
Hi,
I'm new to using OOP in PHP (And in general) and I had a question about inheritance.
I have the following classes:
class OCITable {
public function display() {
$this->drawHeader();
$this->drawFooter();
$this->drawBody();
}
private function drawHeader() {
...
}
private function drawFooter() {
...
}
...
Hi all,
I'm creating an interface for "PickupPoints", Each pickup point needs to be able to return all pickup points found and the pickup point details and maybe in the future more information. That's okay with the code below:
<?php
interface iPickupPoint
{
public function getPickupPoints($countryCode, $postalCode, $city);
pub...
Hi,
In Java, Is there a way to prevent extending an interface.
Since final cannot be added to an interface , i was curious to know whether there was a way if any, to prevent extending an Interface.
...
Possible Duplicate:
When to use an interface instead of an abstract class and vice versa?
Hi, I am teaching OOP concepts to non-programmers. I wanted to know how can you explain the difference between an interface and an abstract class.
What I am actually looking for, is a real world example that can help highlight the differe...
I'm trying to learn how to best use OOP in PHP. Please be aware that even if I studied the theory of this new "world" I didn't enter the OOP thinking yet obviously.
What's the difference between using normal, separated functions and putting them in a class as methods?
Let's say I have a class called "shop".
It has these methods: retr...
Possible Duplicates:
Im looking for some good object oriented books
Learning OOP well
plz explain the basic concepts of OOP with examples in. which is the best book or web site for reference plz guide me
...
I'm sure this is incredibly common with as OOP centered as Java is. In java is there a way to make a base type variable that accepts all inherited subtypes? Like if I have;
class Mammal {...}
class Dog extends Mammal {...}
class Cat extends Mammal {...}
class ABC {
private Mammal x;
ABC() {
this.x = new Dog();
...
I wrote a base class which defined many protected methods. Those methods are called in its sub classes.
The methods define basic operations for its sub classes.
For instance:
class Base{
protected void foo(){}
protected void bar(){}
}
class Sub1 extends Base{//The sub class only needs Base.foo()
public void po(){
...
...
I have a class defined as:
TfraFrame = class(TFrame);
then I have several subclasses all inherting from this, such as:
TfraUsers = class(TfraFrame);
TfraGroups = class(TfraFrame);
TfraMenus = class(TfraFrame);
In my main form i have declared variables as:
var
fraUsers: TfraUsers;
fraGroups: TfraGroups;
fraMenus: TfraMenus;
...