I defined a superclass element. There is some derived class elementsay triangle, quadand cube. Some of the objects elementare boundary elements. If it elementis a boundary element, then I have to define additional data members and functions. I could easily get a class boundary_elementif the class is elementnot a base class. (I meant that if triangle, quadand cubeare separate classes, I can define separate derived classes, such as boundary_triangle, boundary_quadand boundary_cube).
So my problem is that I have to define a subclass boundary_elementthat should be the base (or even abstract) class to define the derived classes boundary_quad, boundary_triangleand boundary_cube.
How is this possible in C ++? can anyone suggest any architecture that serves the purpose?
Another way to solve my problem according to my logic is to define a class as shown below:
class boundary_element
{
element* m_boundary_elem;
//data members needed for quad,triangle and cube
public:
boundary (element*);
//functions for modifying data of triangle,cube,quad.
}
A pointer is elementdefined as a member variable of another class. How can I restructure this class efficiently using inheritance. (i.e. use it as an abstract class to get classes boundary_triangle, boundary_quadand boundary_cube)
, , , , , . , .