I hope this question takes a simple fix, and I am just missing something very small.
I am in my second semester of C++ in college, and we are just getting into OOP. This is my first OOP program, and it is causing me a little problem. Here are the errors I am getting:
Member function must be called or its address taken in function displ...
Whenever I tried to search about differences between classes and structs in C# or .net, I ended up with the conceptual overview of the two things like value type or the reference type, where the variables are allocated etc. But I need some practical differences. I have found some like different behavior of assignment operator, having con...
After finishing my C++ class it seemed to me the structs/classes are virtually identical except with a few minor differences.
I've never programmed in C before; but I do know that it has structs. In C is it possible to inherit other structs and set a modifier of public/private?
If you can do this in regular C why in the world do we nee...
I have a function that I am calling that runs all the way up to where it should return but doesn't return. If I cout something for debugging at the very end of the function, it gets displayed but the function does not return.
fetchData is the function I am referring to. It gets called by outputFile. cout displays "done here" but not "da...
ie. i have the following:
<div class="myclass">my text1</div>
some other code+containers...
<div class="myclass">my text2</div>
some other code+containers...
<div class="myclass">my text3</div>
some other code+containers...
i have the css class div.myclass {doing things} that applies to all obviously but i also wanted to be able to ...
I'm just venturing into the world of OOP so forgive me if this is a n00bish question.
This is what I have on index.php:
$dbObj = new Database();
$rsObj = new RS($dbObj);
This is the Database class:
class Database
{
private $dbHost;
private $dbUser;
private $dbPasswd;
private $dbName;
private $sqlCount;
funct...
function FakeClass(){};
FakeClass.prototype.someMethod = function(){};
FakeClass.prototype.otherMethod = function(){
//need to call someMethod() here.
}
I need to call someMethod from otherMethod, but apparently it doesn't work. If i build it as a single function (not prototyped), i can call it, but calling a prototyped does not ...
I noticed that there are two ways to create C++ objects:
BTree *btree = new BTree;
and
BTree btree;
From what I can tell, the only difference is in how class objects are accessed (. vs. -> operator), and when the first way is used, private integers get initialized to 0.
Which way is better, and what's the difference?
How do you k...
I want a static inner class that can't be instantiated even by the external class. Right now I just have a documentation that says "Please don't instantiate this object". Can I give a better signal?
...
I am writing a UTF-8 library for C++ as an exercise as this is my first real-world C++ code. So far, I've implemented concatenation, character indexing, parsing and encoding UTF-8 in a class called "ustring". It looks like it's working, but two seemingly equivalent ways of declaring a new ustring behave differently. The first way:
ustri...
Hello there. I have a set of code, which mimics a basic library cataloging system. There is a base class named items, in which the the general id,title and year variables are defined and 3 other derived classes (DVD,Book and CD).
Base [Items]
Derived [DVD,Book,CD].
The programs runs, however I get the following warnings, I'm not sure ...
I have a Ruby class called LibraryItem. I want to associate with every instance of this class an array of attributes. This array is long and looks something like
['title', 'authors', 'location', ...]
Note that these attributes are not really supposed to be methods, just a list of attributes that a LibraryItem has.
Next, I want to mak...
Let's say I'm trying to implement a Chess Game.
I'd create my Chess classes in a Chess namespace. Now, should I prefix all my Chess related classes with the Chess word, or as they are already inside that namespace, should I just call them by what they are?
Example:
ChessGame vs Game
ChessPiece vs Piece
...
A friend and I had an argument last week. He stated there were no such things as classes in Javascript.
I said there was as you can say var object = new Object()
he says "as there is no word class used. Its not a class.
-- Whats your take on it guys?
thanks.
...
The following is a great tutorial about using the Language Class. But I think the author forgot about creating the controller file. I just started using CI today and I'm not sure how to name the controller file for the view "example.php".
The tutorial:
http://codeigniter.com/wiki/Internationalization_and_the_Template_Parser_Class/
...
I've implemented some of the changes suggested in this question, and (thanks very much) it works quite well, however... in the process I've seemed to break the post-declaration assignment operator. With the following code:
#include <cstdio>
#include "ucpp"
main() {
ustring a = "test";
ustring b = "ing";
ustring c = "- -";
ustrin...
I have the following code, which uses a Unicode string class from a library that I'm writing:
#include <cstdio>
#include "ucpp"
main() {
ustring a = "test";
ustring b = "ing";
ustring c = "- -";
ustring d;
d = "cafe\xcc\x81";
printf("%s\n", (a + b + c[1] + d).encode());
}
The encode method of the ustring class instances co...
What i think about virtual class is, if a derived class has a public base, let's say, class base, then a pointer to derived can be assigned to a variable of type pointer to base without use of any explicit type conversion. But what if, we are inside of base class then how can we call derived class's functions. I will give an example:
cl...
Need to create a class that will do all things as the "merge" function. In class i will change, process and add new arguments.
def merge(*arg, **kwarg): # get decorator args & kwargs
def func(f):
def tmp(*args, **kwargs): # get function args & kwargs
kwargs.update(kwarg) # merge two dictionaries
r...
from my understanding, require pastes code into the calling php file.
what if you were requiring from inside a method...it would paste the entire code/class inside the method, blocking the next statement in the method.
eg.
function test() {
require 'pathtosomeclasscode';
somestatement; // any code after the require is block...