|
Hello,
Thanks for you reply
This is my code snippet
class CRICH : public CRichEditCtrl
{
// Construction
public:
CRICH();
void Fill(CFont& H,Variant Data);
void Create1(CView *pView,CRect Rect,int index);
bool operator =(CRICH& c);
};
The following is a template class
template <class T> class TDataTable
{
public:
TDataTable();
TDataTable(int m, int n);
void constructor(int m,int n);
void clear() {m_numRow=m_numCol=0; TData.clear();};
void InsertRow(int rowno);
void DeleteRow(int rowno);
void AddRow();
int numRow() {return m_numRow;};
int numCol() {return m_numCol;};
T& operator() (int i,int j) {return TData[m_numCol*i+j];}
vector<T> GetOneRow(int i);
//virtual ~TDataTable();
private :
int m_numRow, m_numCol;
vector<T>TData;
T tdefault;
};
The following is the function constructor which I want to call while initializing objects in a vector
template <class T> void TDataTable<T>::constructor(int m, int n)
{
tdefault = T();
m_numRow = m; m_numCol = n;
TData.assign(m_numRow*m_numCol, tdefault);
}
If I call the function constructor() like the following
TDataTable<crich*> m_TableForDisplay;
m_TableForDisplay.constructor(row,col);
now TData is not initialized and while debugging if I press F11 at the point
tdefault = T();
then the constructor of CRICH is not called.
but for other of my classes their respective constructors
are called and tdefault gets initialized
Thanks
Prithaa
|
|
|
|
|
Can any one tell to me thet how to use SetPrinterDataEx() function to set the registry value. i am trying to do this:
DWORD dw=SetPrinterDataEx(hPrinter,"PrinterDriverData","monica",REG_BINARY,(PBYTE)p,1);
it compiled overall prgram but not set registry key(name "monica").it returns 'dw =5'. what is meaning of '5 value of dw'.
Thanks
Monica
|
|
|
|
|
mo_nica881 wrote: DWORD dw=SetPrinterDataEx(hPrinter,"PrinterDriverData","monica",REG_BINARY,(PBYTE)p,1);
Can you show how variable p is defined ?
mo_nica881 wrote: what is meaning of '5 value of dw'.
Access denied.
Check you have all right to do this operation.
|
|
|
|
|
Hello,
If I have a class
class A
{
int *myint;
};
I can initialize the above member variable like this
int *myint = new int;
so that a pointer is initialized on the heap and I will have to delete it.
But if I have to initialize the member variable in the constructor of a class how should I do it using new?
Thanks
Prithaa
|
|
|
|
|
Exactly the same but in the constructor:
A::A()
{
myint = new int;
}
Don't forget to destroy it in the destructor of your class then.
|
|
|
|
|
Although you can simply write,
myint = new int;
Be aware while using assignment operator or copy constructor. If you are not cautious, will end up with dangling pointers.
|
|
|
|
|
WTF ??
This was posted more than 3 years ago !! Furthermore, you are replying to me and not to the OP.
|
|
|
|
|
|
You could use a std::auto_ptr but should beware of the transfer of ownership on copy semantics. This could mean, for example, that an assignment breaks the object on the right hand side.
Steve
|
|
|
|
|
Hello,
Thanks I got it.
Prithaa
|
|
|
|
|
Can anybody forward me code that will implement multithreading in VC++?
|
|
|
|
|
|
I dont know I cant see your answer or your answer is inside Quote;P
|
|
|
|
|
reposted
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
|
Can i convert a SDI application to MDI application in VC++?What's the procedure & what are required changes i will have to do in SDI application?Please reply as soon as possible.
Thanks & Regards
Pankaj
|
|
|
|
|
|
I am using
char a[10];
memset(a, 0, sizeof(a));
The problem is:
In debug a is set 0 but not in release.
What may be the reason?
|
|
|
|
|
Ordinal wrote: In debug a is set 0 but not in release.
how do you check that?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
Can you post the code?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Ordinal wrote: using MessageBox
what does i showing.. could you show me that!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
in debug - 0
in release - garbage value
|
|
|
|
|
Ordinal wrote: in debug - 0
That is even not possible. It should show nothing and not 0. 0 is a character with a specific value. Can you post the code ? I think you are doing something wrong.
|
|
|
|