I only very recently began developing professionally. I studied OOP while at University, but don't feel as if I ever really used it in a "real world" scenario.
Basically, in trying to create/manipulate a specific type of document within the organization, I created a class for it, with the thinking that anytime we wanted to create/manipu...
Using a very simple set of objects for this example in PHP.
Lets say:
ObjectA:
Properties: DescId;
Methods: getListofData();
ObjectB:
Properties: DescId;DescName;
Methods: getDescNameById();
What I want to know is what is the best way to get the DescName from ObjectB when ObjectA is the one calling the function from within a lo...
Now can anyone explain polymorphism to me? I'm not sure I am understanding it correctly.
In the Python scope, what I am getting out of it is that I can define parameters as followed:
def blah (x, y)
without having to specify the type, as opposed to another language like Java, where it'd look more along the lines of:
public void blah...
Hi everyone,
One way to hack limited form of polymorphism in C is to do something like this:
typedef struct {
int x;
} base;
typedef struct {
base super;
int y;
} derived;
Now you can refer to a derived instance as a base instance, depending on how the variable is cast, ie:
derived my_derived;
my_derived.y = 10;
my_der...
Hello Everyone,
I know this sort of question has been asked before, but I still feel that the answer is too ambiguous for me (and, by extension, some/most beginners) to grasp.
I have been trying to teach myself broader concepts of programming than procedural and basic OOP. I understand the concrete concepts of OOP (you make a class th...
I'm building a class or two based on StdRegProv to handle Windows Registry via PHP's COM class. For reference to all known StdRegProv methods and types, see: http://msdn.microsoft.com/en-us/library/aa393664%28v=VS.85%29.aspx. (Don't even get me started on the fact that I have to know what Reg type a named value is just to get or set i...
Hi,
I have a piece of code which deals with customers stored in database. There is an object Customer, and it has, among other, two properties of type byte[]: one property for password salt, the second one for password hash.
Checking the code with FxCop, I see that it complains (CA1819, Performance Rules) that:
"Properties that ret...
Recently, I finished reading K&R with its, almost all, exercises and examples. I was planning to move to "Accelerated C++" that I came across Axel Schreiner's book OOP with ANSI-C.
I am intrigued and want to learn it. But before investing time in it, I want to know the worth of implementing OOP in C. So that I can decide how much time I...
I want to know , why Python is not full object-oriented ? (e.g : Does not support private , public , protected) .
What`s the advantage and disadvantage of this ? By this expressions , Python is suitable for what applications (Desktop , Scientific , Web or ...) ?
Thanks .
...
Say if I want to extend the functionality of a range of objects that I cannot change - for instance for adding formatting, and don't want to derive a huge amount of classes to extend the functionality - would the following considered bad? (I'm using int and float as an example, but in my program I have about 20 or 30 classes that will e...
I would like to implement something like this because my application is divided into scenes and this gets sort of messy:
glEngine.scene[glEngine.current.currentScene].layer[glEngine.scene[glEngine.current.currentScene].currentLayer].Shapes.push_back(CGlShape());
instead I'd want to be able to do something like this:
glEngine.Scene()....
Hello guys and gals,
Is it common in Python to keep testing for type values when working in a OOP fashion?
class Foo():
def __init__(self,barObject):
self.bar = setBarObject(barObject)
def setBarObject(barObject);
if (isInstance(barObject,Bar):
self.bar = barObject
else:
# throw ...
Why is this giving error?
class content {
protected $id,$title,$content,$image,$imagedirectory,$page;
protected $sid = md5(time()); //In this line : parse error, expecting `','' or `';''
}
...
I am using PHP and Smarty. I have a simple application that:
Shows page header
Checks if user is logged in -> check session
Checks if user wants to log out -> then clear session
If logged in shows a menu.
If not logged in, then challenges user for id/password -> set session
Shows page footer
Now I want to add the following to header:...
I'm working on a project for visually tracking trains. I've refactored the object relationship between the trains, the tracks, and the respective drawing classes for each several times, and I'm not happy with any of them. Maybe you guys can help me out here.
Here are the interfaces to the objects I've got now.
Tracks:
addControlPoi...
Hi,
I have a user interface with a tree view on the left, and a viewer on the right (a bit like an email client). The viewer on the right displays the detail of whatever I have selected in the tree on the left.
The user interface has "add", "edit" and "delete" buttons. These buttons act differently depending on what "node" in the tree...
Given an Array Literal inside a JavaScript Object, accessing its own object's properties does not seem to work:
var closure = {
myPic : document.getElementById('pic1'),
picArray: [this.myPic]
}
alert(closure.picArray[0]); // alerts [undefined]
Whereas declaring an Array Item by accessing an other JavaScrip...
I'm writing a jQuery plugin, and I'm writing it in a non-jquery-community-standard way, mainly
to maintain portability and extendability.
I'm having some trouble accessing variables that were declared in the function when accessing from the prototype.
Perhaps I have this model very wrong but I hope someone can point out the correct...
I look for python tutorial but dealing with OOP, I don't need conditions, loops and other stuff, only OOP things and python decorators, generators, etc etc.
And I look for tutorial with practical examples, which make sense, not Fibonacci, I can't learn from abstract non-useful examples. If it will be some part of some python framework tu...
In my project I have strongly typed viewdata in the spirit of the following:
AppleListViewData : ViewDataDictionary
+ SelectedTheme
+ ThemeList
+ SelectedApple
+ AppleList
Where the first four are re-occuring accross all the viewdatas because they are used in the site.master
To keep it DRY I elevated them into a BaseViewData c...