Reason is, I'm trying to compare the space efficiency between 2 data structures... that's why I'm trying to print out all the memory used to run my programs.
Thanks guys!
MacGyver: Oh, okay....
Type: Posts; User: markcls
Reason is, I'm trying to compare the space efficiency between 2 data structures... that's why I'm trying to print out all the memory used to run my programs.
Thanks guys!
MacGyver: Oh, okay....
EDIT: Oh, looks like you answered my question, vart. It's (a), right? Thanks!
Ah, you guys are amazingly good at spotting my mistakes!
I do know that the size of hello is actually 6 bytes...
When calculating for space efficiency, do I have to calculate everything, or just the node size?
For example:
Let's say I have a linked list structure. It consists of a string, and a pointer to...
I tried doing it like this:
Enums::MyEnumType x;
int i = x.ALPHA;
but it didn't work :(
The error was:
Program.cpp: 16: error: request for member 'ALPHA' in 'x', which is a non-class...
Having problems understanding enum in C++.
But what if I have two different enum types? Say
enum MyEnumType { ALPHA, BETA, GAMMA };
enum SomeonesEnumType { ALPHA, SATURDAY, MONDAY };
...
Heheh, sorry :(
I've been reading the tutorials and FAQs, and have started testing my own code.
But I just wanted to reconfirm. Because I saw a site saying you could call it using Base::, but I...
How do I call public methods of the base class (the class it was inherited from, aka super class)?
I have been reading around but it has been quite unclear.
Say, for instance, I wanna call a...
Hahaha sorry, I don't think I have to set the class as static (I don't even know why I thought of that). Got it working already. Thanks :)
What is the string class for?
How come I can declare strings without having to include the string class?
I just include <iostream> and also use "using namespace std". Does that include strings...
In Java, I would do this:
public interface Date {
public static final String[] month = { "January", "February", "March", etc etc};
}
Ouch, didn't see that.
Anyways thanks guys! Do you guys even ever sleep?
Hi, I'm having trouble compiling my program.
main.cpp file:
#include <iostream>
#include "Test.h"
using namespace std;
Hey, thanks everyone :)
twomers: Hmm, so does that mean if I define a deconstructor to free whatever memory I've allocated for that object, I won't have to specifically free (delete) the object...
Like the title suggests, for OOP, do I need to define a deconstructor all the time?
Or do I just not type it at all, will it have a default deconstructor, like the default constructor?
Ohhhh ok! Thanks :)
And omg, you guys are efficient. Wow.
Hmmm, so if I have 5 classes (errr, 5 .cpp files), I should have 5 header files, and in each of the source files, I have 5 (or 4) #includes to include every single header?
Edit: Sentral... oh...
Err sorry, what do you mean by using the "using std::something" to know what you're using in your classes?
Hi all,
I'm trying to code a very very simple program with multiple files (like for Java, i have many classes, all in seperate files)
How do I achieve that?
Do I have Main.cpp, SomeObject.h,...
hey, thanks for the quick replies, everyone :D
so basically, for each class that is related to one whole namespace, i just put them between the namespace braces?
e.g.
#include <iostream>
...
Is there an equivalent of namespace or package in C++?
For instance,
In C#:
using System;
using System.Collections.Generic;
using System.Text;