Object of abstract type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Is it possible somehow to construct an array of objects of abstract
type?

This is the illustration of what i am trying to do:

class A
{
 ...	
};

class B1 : public A
{
 ...
};

class B2 : public A
{
 ...
};

int main()
{
	int n;
	A *array = new A[n];
	
	...

	B object;
	array[int i] = object;

	...	
}

I am aware that an object of virtual class can not be allocated. But, is
my idea solvable in a simple manner?

Thanks!

Benjamin Batistic


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux