Click here to Skip to main content
16,011,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help: Vector class won't work (read this one) Pin
Christian Graus19-Dec-02 13:40
protectorChristian Graus19-Dec-02 13:40 
GeneralRe: Help: Vector class won't work (read this one) Pin
KBL19-Dec-02 12:57
KBL19-Dec-02 12:57 
GeneralRe: Help: Vector class won't work (read this one) Pin
Alvaro Mendez19-Dec-02 10:55
Alvaro Mendez19-Dec-02 10:55 
GeneralRe: Help: Vector class won't work (read this one) Pin
KBL19-Dec-02 12:03
KBL19-Dec-02 12:03 
GeneralRe: Help: Vector class won't work (read this one) Pin
KBL19-Dec-02 12:07
KBL19-Dec-02 12:07 
GeneralRe: Help: Vector class won't work (read this one) Pin
KBL19-Dec-02 12:16
KBL19-Dec-02 12:16 
GeneralRe: Help: Vector class won't work (read this one) Pin
KBL19-Dec-02 13:01
KBL19-Dec-02 13:01 
GeneralRe: Help: Vector class won't work (read this one) Pin
Gary Kirkham20-Dec-02 3:52
Gary Kirkham20-Dec-02 3:52 
Other than not setting rows in you second constructor and not deleting vec in your destructor, there is nothing wrong with your code.

I created a simple console app and cut and pasted your code...no errors.

#include "stdafx.h"<br />
<br />
class vector<br />
{ <br />
<br />
private:<br />
int rows ; <br />
double *vec ; <br />
<br />
public: <br />
vector(void) { rows=0 ; vec=0; } // default constructor<br />
<br />
vector(int rows) // constructor<br />
{ <br />
vec = new double[rows] ;<br />
}<br />
<br />
~vector(void) {} ; // destructor<br />
<br />
} ;<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
	vector* A ; <br />
	A = new vector(15) ;<br />
<br />
	return 0;<br />
}



just a memory leak

There has to be something else...Is this your entire code?

I think this is a good learning exercise...I would advise you to persue it and not spin your wheels over in STL land;)

Gary Kirkham

A working Program is one that has only unobserved bugs
GeneralHelp: Vector class won't work Pin
KBL19-Dec-02 10:42
KBL19-Dec-02 10:42 
Generalvc++ ODBC dynaset,SQL_fetch_bookmark Pin
kingsley19-Dec-02 10:00
kingsley19-Dec-02 10:00 
GeneralRe: vc++ ODBC dynaset,SQL_fetch_bookmark Pin
Henrik_O20-Dec-02 1:09
Henrik_O20-Dec-02 1:09 
GeneralU can help me!! i have a Simple Quiestion !! Pin
Alex H 198319-Dec-02 9:35
Alex H 198319-Dec-02 9:35 
GeneralRe: U can help me!! i have a Simple Quiestion !! Pin
Christian Graus19-Dec-02 9:42
protectorChristian Graus19-Dec-02 9:42 
GeneralRe: U can help me!! i have a Simple Quiestion !! Pin
Alex H 198319-Dec-02 9:52
Alex H 198319-Dec-02 9:52 
GeneralRe: U can help me!! i have a Simple Quiestion !! Pin
Christian Graus19-Dec-02 10:55
protectorChristian Graus19-Dec-02 10:55 
General_beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Peter Weyzen19-Dec-02 9:15
Peter Weyzen19-Dec-02 9:15 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Tim Smith19-Dec-02 9:24
Tim Smith19-Dec-02 9:24 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Peter Weyzen19-Dec-02 9:32
Peter Weyzen19-Dec-02 9:32 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Peter Weyzen19-Dec-02 9:45
Peter Weyzen19-Dec-02 9:45 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Joe Woodbury19-Dec-02 10:47
professionalJoe Woodbury19-Dec-02 10:47 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Tim Smith19-Dec-02 11:28
Tim Smith19-Dec-02 11:28 
GeneralRe: _beginthreadex / GetCurrentThreadId / GetCurrentThread Pin
Tim Smith19-Dec-02 11:27
Tim Smith19-Dec-02 11:27 
GeneralCompiler Warning (level 4) question.. Pin
RobJones19-Dec-02 8:41
RobJones19-Dec-02 8:41 
GeneralRe: Compiler Warning (level 4) question.. Pin
Tim Smith19-Dec-02 8:59
Tim Smith19-Dec-02 8:59 
GeneralRe: Compiler Warning (level 4) question.. Pin
RobJones19-Dec-02 9:10
RobJones19-Dec-02 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.