oop

tinyMCE JQuery plugin - How do you set global config options?

I'm new to tinyMCE and I like the jQuery plugin that comes in the latest version. However I'd like to set global options that would be used in every subsequent instance; for example themes and skins. Is this possible? Edit. Here is an example of the method I have used. $(document).ready(function(){ var config = { direction...

How to find undefined virtual functions of a classes.

I am porting a game from windows to mac. Here I am stuck with a bunch of linker errors. All errors similar to Undefined symbols "typeinfo for Baseclass", referenced from: typeinfo for Subclass Subclass.oor "vtable for Aclass referenced from _ZTVNAclass:` I know that the problem because of missing definition for virtual fun...

creating a oop php blog

Hi Im trying to develop a oop php driven blog. Im new to the oop way in php so its going quite slow. I have a class BlogPost were I have created the private variables for the rows in my blog field in he db and getters and setters for them example: function getCreated() { return $this-$created; } function setCreated($created) { ...

Why are protected members allowed in final java classes?

Why are protected members allowed in final classes? Shouldn't this be a compile-time error? Edit: as people have pointed out, you can get same package access by using the default modifier instead. It should behave in exactly the same manner, because protected is just default + sub-classes, and the final modifier explicitly denies subc...

Design question in Python: should this be one generic function or two specific ones?

I'm creating a basic database utility class in Python. I'm refactoring an old module into a class. I'm now working on an executeQuery() function, and I'm unsure of whether to keep the old design or change it. Here are the 2 options: (The old design:) Have one generic executeQuery method that takes the query to execute and a boolean com...

PHP: Calling a private method from within a class dying badly

So this might sound a little convoluted. Fingers crossed I come across clearly. I'm working in an MVC framework in PHP. I load a controller /report/index which calls to a helper <? class ReportController extends Controller { public function index() { $foo = MainReport::get_data($_REQUEST); } } ?> ...

Get object class name from within parent class?

I am wanting to use the get_class($var) to show the class of an object. What would be the best way to do this? My code at the moment is: abstract class userCharacter { var $cName; var $cLevel = 0; var $cHP = 50; var $cMP = 20; function __construct($n) { $this->cName = $n; } function showDetails() {...

Best c# book for beginning to intermediate

I have taken a c# class, a VB class, and 2 java classes in college. I write TSQL and SQL daily at work and want to move more into the c# developer role. My major in college was MIS so I have knowledge of classes, database schemas, application design concepts etc. I am wondering what the best book would be for me. I am looking at doing ...

create object based on time in c++

hi, i am writing a simulation about vehicle manufacturing, i am wondering how i can create objects based on time.. i have a base class Vehicle, and children Motorbike, Car, and Truck. 1 Motorbike will be manufactured every 1 hour, 1 car will be manufactured every 3 hours, and 1 truck will be manufactured every 8 hours. how can i create...

How is Ruby more object-oriented than Python?

Matz, who invented Ruby, said that he designed the language to be more object-oriented than Python. How is Ruby more object-oriented than Python? ...

Catching the right event with the right listener?

Hi, Consider this scenario we have a class A which is singleton it has a function Sum(a,b) ** . Now we have two classes **Class B and Class C respectively. Both classes (B,C) call add function and listen for a event. Class A { function add(a:int,b:int):void { c:int = a+b; dispatchEvent(new myEvent(myEvent.addC...

Is it a good practice to have static variables to store global, changing information?

Is it a good OOP practice to have static variables to store global, changing information needed by different classes? as opposed to passing parameters around so that it can be accessed by the called classes. ...

Can I treat a class as a object type?

Hi, I have a custom class say class A : class A { public testA:int; public testB:int; } Now, I have a object say Object C , the object has the exact same names of variables and everything as the class. My question can I cast that object into class or vice versa. Instead of set/get of individual variables. ...

Best design pattern to insulate child object methods contained in parent object array

Hello, I'm trying to figure out the best design pattern to insulate a child object from knowing too much about the parent object it is contained in. For instance, with a parent class like this... class Airplane { var seats:Array ... function removeSeat(seat:Seat) { // find seat object in seats array and remove it } } c...

syntax error, unexpected T_RETURN, expecting T_FUNCTION oop php

Hi, Im receiving an error as stated above. Its referring to my return statement. Any one got any clues on this?! Thankful for all help! Regards! public function getPosts() { $result = $this->db->query("SELECT * FROM posts"); $posts = array(); while($posts = $result->fetch_assoc()) { array_push($p...

Which design pattern is this?

In a current (C#) project we have a 3rd party assembly that contains a non-interfaced connection object. Using IoC, etc we can inject this concrete instance into our code, but it is proving a nightmare to unit test, etc. We are using MoQ as our mocking framework so ideally could do with an interface to work off and we don't want to go ...

JavaScript Scope question

As someone who is attempting to take a more object oriented approach to my javascript programming I've hit a stumbling block which I'm sure is probably something very basic, but, take the following object implementation (assume that the jQuery object is available to this code): function Foo() { this.someProperty = 5; } Foo.prototyp...

Different ways to reference yourself?

The handle to yourself is called different things in OOP languages. The few I've come across so far: this (e.g. Java, C#) Me (e.g. VB, vba) self (e.g. Python) Anyone know any others? ...

Programmatically get class methods and properties?

OK first, given a file, say somefile.php is there a way to search that file for a Class? Then, once you have the class, is there a way to get all the public properties and method signatures? I am trying to create a way to document PHP classes on the fly. ...

Late Binding vs. Polymorphism - what is the difference?

I've seen both used interchangebly but do they really mean the same? From my understanding, Polymorphism stretches the fact that you could exchange an instance of a class by an instance of a subclass, and Late Binding means that when you call a method of an instance, the type decides which method (subclass/superclass) gets called. ...