Hello,
Simple lua game with simple class like so:
creature = class({
name = "MONSTER BADDY!",
stats = { power = 10, agility = 10, endurance = 10, filters = {} },
other_things = ...
})
creatureA = creature.new()
creatureB = creature.new()
creatureA.name = "Frank"
creatureB.name = "Zappa"
creatureA.stats.agility = 20
creatureB.s...
I need some classes to befriend other classes in my system. Lack of this feature made me publicize some methods which shouldn't be public. The consequences of that are that members of my team implement code in a bad and ugly way which causes a mess.
Is there a way to define a friendship in php 5.3?
(I am aware of http://bugs.php.net/...
Hi,
Douglas Crockford seems to like the following inheritance approach:
if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
newObject = Object.create(oldObject);
It looks OK to me, but how does it differ from John Resig's simpl...
I'm a big fan of OOP in php, but i feel like defining class methods gets disorganized so fast. I have a pretty good background in OOP in C++, and i am pretty comfortable with how it is handled there, and am curious if there are ways to do it similarly in php.
To be more specific, here is what i mean. I like how in C++ you can define a ...
i try to call base.Alan(); in HacimBul. But base. dont give intellisense alan method
public double HacimBul()
{
throw new Exception();
//return base..... --> how can i see base.Alan();
}
namespace interfaceClass
{
class Program
{
static void Main(string[] args)
{
...
Let's assume I have a class called MyClass with an attribute called MyAttribute and a method called MyMethod(). Inside that method I'd like to have a variable called MyVariable. I'd like to set the value of MyVariable to "MyVariable" and MyAttribute to "MyAttribute" inside the call to MyMethod(). How can I do this in a Collaboration Diag...
I'm trying to make the domain model of a management system. I have the following kind of people in this system:
employee
manager
top mananger
I decided to define an User, from where Employee, Manager and Top Manager will specialize from.
Now, I don't know what kind of specialization hierarchy I should choose from.
I can't decide betw...
Possible Duplicate:
What is the use of marker interfaces in Java?
What are marker interfaces and why are they used?
...
Possible Duplicate:
String vs string in C#
What is the difference Between String and string or Double and double?
if i use :
double s1; or
if i use Double s1;
can you give pros and cons?
...
i try to generate some codes. i face to face delegates. Everythings is ok.(Look below) But appearing a warning: you shold assing value why? but second code below is ok.
namespace Delegates
{
class Program
{
static void Main(string[] args)
{
HesapMak hesapla = new HesapMak();
hesapla.Calculator = ...
Frameworks being all OOP, would it not be wise to go into frameworks without having a solid background in OOP? I can write basic classes but nothing too fancy or abstract.
How much should I know of OOP before moving to frameworks?
Right now I am PHP Object-Oriented Programming to learn OOP.
EDIT: Once you start programming in OOP, i...
Suppose you have an method on an object that given the some input alters the objects state if the input validates according to some complex logic.
Now suppose that when the input doesn't validate, it can be due to several different things, each of which we would like to be able to deal with in different ways.
I'm sure many of you are t...
That may sound a little confusing. Basically, I have a function
CCard newCard()
{
/* Used to store the string variables intermittantly */
std::stringstream ssPIN, ssBN;
int picker1, picker2;
int pin, bankNum;
/* Choose 5 random variables, store them in stream */
for( int loop = 0; loop < 5; ++loop )
{
...
Hey guys,
I have got a problem with my codeigniter library. To transform database data into a navigation and have active elements and such like I build a library class CI_Navigation().
It works perfectly fine, I just have one problem.
Often on webpages one has corresponding but separated navigations e.g. a main navigation at the top a...
public static string BoldStartTag { get { return "<B>"; } }
VS
public static readonly string BoldStartTag = "<B>";
or
public static const string BoldStartTag = "<B>";
which one is preferred? I would think the readonly/constant variable as I am not doing any computation in the property (just return). Also, the C# compiler ...
I saw some comments on forums, and it seems that people want to be able to inherit from multiple classes in c#. Why would you ever need this? I can't think of any use for this, but since there's people that want it, there's got to be some.
...
In brief, my question is about member variables as pointers in unmanaged C++.
In java or c#, we have "advanced pointer". In fact, we can't aware the "pointer" in them. We usually initialize the member of a class like this:
member = new Member();
or
member = null;
But in c++, it becomes more confusing. I have seen many styles: usin...
I have made a class in php which is goind to be inherited by another class in the other folder.
when i put echo $this->protectedvariableofclass; //in subclass function
it gives no value
remember my base class is stored \class\user.php
sublass is stored as \model\model_user.php
Please help me out
Thanks in advance
Base Class in \class\...
I'm writing a class to handle a memcached object. The idea was to create abstract class Cachable and all the cachable objects (such as User, Post, etc) would be subclasses of said class.
The class offers some method such as Load() which calls the abstract function LoadFromDB() if the object is not cached, functions to refresh/invalidate...
i try to write a winform application:
i dislike below codes:
DataTable dt = new DataTable();
dt.Load(dr);
ds = new DataSet();
ds.Tables.Add(dt);
Above part of codes looks unsufficient.How can i best loading dataset?
public class LoadDataset
{
public DataSet GetAllData(st...