Thanks again for the help.
I figured out how to do the dynamic array. I needed an A** arrray. here is my main code
void main(void)
{
int size;
cout << "Enter size of the array << ";
cin >> size;
A** array; array = new A*[size];
int i;
for (i=0; i<size; i++)
array[i] = new B;
for...
thanks for the help. the above code works for constant array size. however it gives an error when trying to delete the array.
Also, I would like to have a dynamic array size. When using new it seems that the array is of type A and not A* so A::print gets called instead of B::print. Also when I...
I am having trouble with inheritance. here is a code sample. when i run the program it displays the first B object (ie the array of integers) but then i get an access violation. can anybody let me know what i am doing wrong? when i only create a pointer to a single B object it works fine. but...
I am getting a linker error whe nusing templates. If i remove the templates from the following sample and make the num member of A an int by default i get no error.
I have header file (A.h):
template <class T>
class A {
public: A(): num(1) {}
~A() {}
void print();
private: T...
Hi,
In my MFC app I have a button which when clicked draws a few lines in the dialog window. If the button is re-clicked i need the previously drawn lines to be erased before drawing new ones. How do I accomplish this?
Thanks
myClass.h is :
class myClass {
private:
int num;
public:
myClass();
~myClass() {}
int getNum();
};
myClass.cpp is :
#include "myClass.h"
myClass::myClass()
{ num = 7; }
int myClass::getNum()
{ return num; }
When the two files are separate as shown here i get the error. However...
Hi,
I have a class called myClass and i compile for use with jni using the following 'cl -Ic:\program*\Java\jdk1.5.0_01\include -Ic:\program*\Java\jdk1.5.0_01\include\win32 -LD myClassImpl.cpp -FemyClass.dll'
myClassImpl.cpp implements the native call to getNum.
class myClass {
private...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.