Forum: C++ Mar 22nd, 2007 |
| Replies: 3 Views: 845 ok cuz I thought that I could just directly access protected member data in the base class through an instance of the derived class (the uncommented part doesn't work). I'm not sure why that is... |
Forum: C++ Mar 21st, 2007 |
| Replies: 3 Views: 845 If I do a public inheritance and the member data in the base class I'm deriving from is protected, is the only way to access the data in the base class via member/friend functions of the derived... |
Forum: C++ Mar 1st, 2007 |
| Replies: 1 Views: 1,018 Hi, I can't get the following code to work. I have my converting constructor (second line) to change an int type to a car type but my compiler says there's something wrong with the overloaded +... |
Forum: C++ Mar 1st, 2007 |
| Replies: 3 Views: 1,042 How do i dereference a pointer to something in a class without having to write another function to dereference it for me? For instance in this code:
class Fraction
{
public:
Fraction(int left... |
Forum: C++ Feb 27th, 2007 |
| Replies: 2 Views: 1,016 ok i figured the problem out. It turns out that I opened the same file twice.. |
Forum: C++ Feb 27th, 2007 |
| Replies: 2 Views: 1,016 states.txt file
Connecticut,1788,Hartford,29
Maine,1820,Augusta,40
Massachusetts,1788,Boston,13
New Hampshire,1788,Concord,41
Rhode Island,1790,Providence,43
Vermont,1791,Montpelier,49... |
Forum: C++ Feb 27th, 2007 |
| Replies: 2 Views: 1,016 The problem I'm having is with overloading the >> operator so that I could read data from a file directly into a class's member data. Everytime I run through the program, it just crashes. when I... |
Forum: C++ Feb 15th, 2007 |
| Replies: 7 Views: 2,092 In the makeDb() function, I returned the instance back by value. Based on my teacher's lecture last Tuesday, however, that's very wasteful (as you have to invoke ctor/dtor/copy ctor calls) and we're... |
Forum: C++ Feb 15th, 2007 |
| Replies: 7 Views: 2,092 #include <iostream>
#include <cstring>
#include <fstream>
#include "state.h"
#include "database.h"
using std::cout;
using std::cin;
using std::ifstream; |
Forum: C++ Feb 15th, 2007 |
| Replies: 7 Views: 2,092 |
Forum: C++ Feb 15th, 2007 |
| Replies: 7 Views: 2,092 erg i take it back. The problem i'm actually having is with trying to return something by a method called 'return value optimization.' I can't seem to create a copy of the db in the function to the... |
Forum: C++ Feb 14th, 2007 |
| Replies: 7 Views: 2,092 I'm having a bit of a problem with function style cast with classes.
When I exit the function I expect an instance of Database to be returned. This instance would then be copied into the db... |
Forum: C++ Feb 14th, 2007 |
| Replies: 8 Views: 4,236 argh sorry i was in a rush and only had a minute to run through the posts. thanks for the replies i will try out the things you guys suggested. |
Forum: C++ Feb 13th, 2007 |
| Replies: 8 Views: 4,236 I dun think i was clear enough...
How do i get it so that if i just prompt the user for input and if he presses ENTER w/o typing anything else in, a function is called? |
Forum: C++ Feb 13th, 2007 |
| Replies: 6 Views: 1,588 yah but the problem is that when I uncomment those two statements out, my program crashes :eek:
I dunno if the rest of the program would help out...
using std::cout;
using std::cin;
using... |
Forum: C++ Feb 13th, 2007 |
| Replies: 8 Views: 4,236 This might seem like a silly question, but how do I read in a newline char, by itself, as input?
For example, if I gave the user a choice to enter a string for a new filename, or let them just... |
Forum: C++ Feb 13th, 2007 |
| Replies: 6 Views: 1,588 class State
{
public:
State::State();
State::~State();
void initState(char * tempName, int tempYear, char * tempCap, int tempPopRank);
void copyState(State & tempState);
void... |
Forum: C++ Feb 13th, 2007 |
| Replies: 6 Views: 1,588 If I have a dynimcally allocated array of objects and each of these objects contains a pointer to a string, when I use the 'delete' function to return memory, do I have to go through each array... |
Forum: C++ Feb 13th, 2007 |
| Replies: 2 Views: 2,492 well thanks for the reply. I think I figured out the problem over lunch lol. |
Forum: C++ Feb 13th, 2007 |
| Replies: 2 Views: 2,492 So in my class we just finished covering the topic of constructors and destructors. Now, my teacher has given us a lab where we have to create these classes and each of them must have a ctor/dtor. ... |
Forum: C++ Jan 31st, 2007 |
| Replies: 1 Views: 1,508 >_<
I've been searching for nearly an hour and trying to find this memory leak. If you guys could help me find it it would be great. Thx.
#include <iostream>
#include <cstring>
#include... |
Forum: C++ Dec 6th, 2006 |
| Replies: 10 Views: 3,551 wow thx :mrgreen:
Isn't the notation *(&tmp) the same as saying tmp. |
Forum: C++ Dec 6th, 2006 |
| Replies: 10 Views: 3,551 thx for the reply.
I used that applet before when we were learning AVL trees. Correct me if I'm wrong, but an AVL tree must be balanced and it does use rotations. If I'm just trying to maintain... |
Forum: C++ Dec 6th, 2006 |
| Replies: 10 Views: 3,551 wow thank you for the reply. I have two questions though:
1) This is similar to rotation, right?
2) Is there a specific case where I would use each on of these? I think I can see that I would... |
Forum: C++ Dec 6th, 2006 |
| Replies: 10 Views: 3,551 I forgot to mention that part of the problem occurs when I try to print the list after I delete a node. I know why I can't print, but I'm not sure how to fix the tree. |
Forum: C++ Dec 6th, 2006 |
| Replies: 10 Views: 3,551 I've been asked to create a movie data baseusing a hash table (w/ linked-list collision resolution) and a BST. Both of them contain a field that points a given structure (we'll call it *pMovie and... |
Forum: C++ Aug 22nd, 2006 |
| Replies: 3 Views: 1,080 #include <stdio.h>
struct FUN {
char x;
char *y;
int z[20];
};
int main(void) { |
Forum: C++ Aug 7th, 2006 |
| Replies: 1 Views: 848 On a recent exam I took, the following question was given:
int ***p;
give the type for the each of the following:
a. p
b. *p
c. **p
d. ***p |