struct foo_struct {
int foo;
double bar;
};
class foo_class {
int foo;
double bar;
// add in a constructor to show that this is a "real class"
foo_class (int _foo, double_bar) : foo(_foor), bar(_bar) {}
// and a method
double mul() { return foo * bar; }
};
class foo_class {
int foo;
double bar;
// add in a constructor to show that this is a "real class"
foo_class (int _foo, double_bar) : foo(_foor), bar(_bar) {}
// and a method
virtual double mul() { return foo * bar; }
};
void *get_hash_entry( hash_table * hash_head, int key )
static_cast<int>( get_hash_entry(arg1,arg2) )
invalid static_cast from type 'void*' to type 'int'
static_cast<int *>(…)
error: invalid conversion from 'int*' to 'int'
error: invalid conversion from 'int*' to 'int'
to Objects. I guess the reason I'm asking is because the one the main things I don't like about Diku / Older
C based muds is the inability to use Class Objects. Which raises another question, how dissimilar is a pointer
to structure and an actual object?
ch->name = "Aragorn"
ch.name = "Aragorn"
yes I know this a vague example, but bear with me. the reason I ask is that I don't all together HATE using C and
because most of the snippets out there are for Diku-rivatives I thought if there is a way for me to take my old ROM base
and add some OOP functionality I might save some valuable hours in getting my project underway.
Because of certain limitations of C I started my Ruby project, which for the most part is a ton of fun, but I had worked on my ROM base for about 10 solid months and don't want that to be a waste if can help it.
So for you C++ guys, do you think learning it would avail me to have a more OOP approach? If I'm correct because C++ is s superset of C I can use most of the snippets already out there.