Search:

Type: Posts; User: markcls

Search: Search took 0.00 seconds.

  1. Replies
    6
    Views
    2,458

    Reason is, I'm trying to compare the space...

    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....
  2. Replies
    6
    Views
    2,458

    EDIT: Oh, looks like you answered my question,...

    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...
  3. Replies
    6
    Views
    2,458

    Calculating space efficiency using sizeof()

    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...
  4. Replies
    3
    Views
    1,574

    I tried doing it like this: Enums::MyEnumType...

    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...
  5. Replies
    3
    Views
    1,574

    Question on Enum

    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 };
    ...
  6. Heheh, sorry :( I've been reading the...

    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...
  7. Question on Inheritance (Calling the base class)

    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...
  8. Hahaha sorry, I don't think I have to set the...

    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 :)
  9. What is the string class for? How come I can...

    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...
  10. Help writing code (Can't think of a proper title)

    In Java, I would do this:



    public interface Date {

    public static final String[] month = { "January", "February", "March", etc etc};

    }
  11. Replies
    12
    Views
    1,222

    Ouch, didn't see that. Anyways thanks guys! Do...

    Ouch, didn't see that.

    Anyways thanks guys! Do you guys even ever sleep?
  12. Replies
    12
    Views
    1,222

    Problems compiling world's easiest program

    Hi, I'm having trouble compiling my program.

    main.cpp file:


    #include <iostream>

    #include "Test.h"

    using namespace std;
  13. Replies
    22
    Views
    4,138

    Hey, thanks everyone :) twomers: Hmm, so does...

    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...
  14. Replies
    22
    Views
    4,138

    Must I always use a deconstructor?

    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?
  15. Replies
    10
    Views
    6,360

    Ohhhh ok! Thanks :) And omg, you guys are...

    Ohhhh ok! Thanks :)

    And omg, you guys are efficient. Wow.
  16. Hmmm, so if I have 5 classes (errr, 5 .cpp...

    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...
  17. Replies
    10
    Views
    6,360

    Err sorry, what do you mean by using the "using...

    Err sorry, what do you mean by using the "using std::something" to know what you're using in your classes?
  18. C++ Object Oriented and Multiple Files Basics?

    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,...
  19. Replies
    10
    Views
    6,360

    hey, thanks for the quick replies, everyone :D ...

    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>
    ...
  20. Replies
    10
    Views
    6,360

    Namespaces or package equivalent in C++

    Is there an equivalent of namespace or package in C++?

    For instance,

    In C#:


    using System;
    using System.Collections.Generic;
    using System.Text;
Results 1 to 20 of 20