Here is a scenario in my mind and I have googled, Binged it a lot but got the answer like
"Abstract class has not implemented method so, we cant create the object"
"The word 'Abstract' instruct the clr that not to create object of the class"
But in a simple class where we have all virtual method, able to create an object???
Also, we ...
(This is not an interface: I simply omitted the method bodies)
class _ {
protected $_data = array();
function __construct($data);
function set($name, $value);
function get($name);
function __set($name, $value);
function __get($name); //aliases for their respective non-magic methods.
# and some other gene...
I want to define a special kind of button that only allows two possible labels: "ON" and "OFF". I decided to inherit from a Windows.Forms.Button to implement this but now I don't know I how should enforce this rule. Should I just override the Text property like this?
public override string Text
{
set
{
throw new InvalidO...
I can clearly see the benefits of having UML diagrams showing your infrastructure of the application (class names, their members, how they communicate with each other etc).
I'm starting a new project right now and have already structured the database (with visual paradigm). I want to use some design patterns to guide me how to code the ...
I may have all this OO completely wrong, but here goes:
Ok, the scenario is a classic order entry.
Customer places an Order which has OrderLineItems of StockItems. Order is entered by Employee.
Application starts and asks for login/password
Employee selects 'Orders' from Mainmenu form
Orders forms opens....
Employee selects Customer
...
I saw the term "Super Object" in CodeIgniter manual, but the term is not explained in details.
So, what is exactly "super object" in CodeIgnter?
...
Is there a way to call "public" javascript functions from "private" ones within a class?
Check out the class below:
function Class()
{
this.publicMethod = function()
{
alert("hello");
}
privateMethod = function()
{
publicMethod();
}
this.test = function()
{
privateMethod();
...
Singletons are so often said to be a bad design choice, so how should you design an application when you want to avoid them?
...
In terms that an OOP programmer would understand (without any functional programming background), what is a monad?
What problem does it solve and what are the most common places it's used?
EDIT:
To clarify the kind of understanding I was looking for, let's say you were converting an FP application that had monads into an OOP applicati...
I've been a PHP programmer for 8 or so years, I'm familiar with OOP and try to consider best practices whenever programming. I would like to pick up C++ to possibly enter the 'game development' field, where now I'm doing web dev.
I'm not a school person, but was wondering what people think about self-taught math to complement learning ...
I'm currently developing an Custom Application using the IP.Board framework, which is in PHP, which by default, creates a IPSMember object for the logged-in user. However, I'm developing an additional class, basically
class SpecialUser extends IPSMember
Is there a way to get the parent object, which is IPSMember to change to Specia...
i have read some posts about the differences between these 3 relationships and i think i get the point.
i just wonder, are all these written the same when coding?
question 1: all 3 are just a value of the object type in a instance variable?
class A {
public $b = ''
public function __construct($object) {
$this->b = $o...
I have Netbeans installed with Visual Paradigm plugin.
I have converted my php code into UML diagrams (modeling -> instant reverse). I can see relations (drawn lines) between superclass and subclasses. However, i cannot see relations between objects inside objects (composition/aggregation/association)?
The code looks like:
class Threa...
there are plenty of frameworks for coding MVC web applications.
this time im going to code a library (think of Doctrine or Solr) with a bunch of class files. u just include a bootstrap or a class file and you are ready to use my classes.
i have never tried to code a library before and intend to code one for learning purpose so that i c...
Sorry my title is not great, this is my first real punt at moving 100% to OO as I've been procedural for more years than I can remember. I'm finding it hard to understand if what I'm trying to do is possible. Depending on people's thoughts on the 2 following points, I'll go down that route.
The CMS I'm putting together is quote small, h...
I am just beginner with Perl, so if it sounds stupid - sorry for that :)
My problem is - I am trying to write a class, which has an empty array, defined in constructor of a class. So I am doing this like this:
package MyClass;
use strict;
sub new {
my ($C) = @_;
my $self = {
items => ()
};
bless $self, ref $C ...
In this PDF presentation on Haskell Type Classes, slide #54 has this question:
Open Question:
In a language with generics and
constrained polymorphism, do you need
subtyping too?
My questions are:
How do generics and constrained polymorphism make subtyping unnecessary?
If generics and constrained polymorphism make subty...
Hi, I am in a bit of a dilemma about how best to handle the following situation. I have a long registration process on a site, where there are around 10 form sections to fill in. Some of these forms relate specifically to the user and their own personal data, while most of them relate to the user's pets - my current set up handles user s...
I have designed the following class that should work kind of like a method (usually the user will just run Execute()):
public abstract class ??? {
protected bool hasFailed = false;
protected bool hasRun = false;
public bool HasFailed { get { return hasFailed; } }
public bool HasRun { get { return hasRun; } }
privat...
Hi,
Is sequential coupling really a bad thing in code?
Although it's an anti-pattern, the only risk I see is calling methods in the wrong order but documentation of an API/class library with this anti-pattern should take care of that. What other problems are there from code which is sequential? Also, this pattern could easily be fixed...