Hi.
I've done most of my studies in Java and so C++/Visual C++ is sometimes confusing for me.
What I want to know is how to inherit a class and create a constructor in the new class that also calls the super class's constructor... or does it do that automatically? I'm not sure.
In Java it's just "super()"
A summarized example of what I'm trying to do:
class shape
{
public:
shape(float width, float height)
{
m_width = width;
m_height = height;
}
protected:
float m_width, m_height;
}
class oval:
ublic shape
{
public:
oval()
{
m_num_of_vertices = 20;
// do the shape constructor
}
protected:
float m_num_of_vertices;
}
VC++ won't even let me make another constructor for the class that inherits from shape(). Why?
Thanks for any feedback you have time to give,
-NeXius
I've done most of my studies in Java and so C++/Visual C++ is sometimes confusing for me.
What I want to know is how to inherit a class and create a constructor in the new class that also calls the super class's constructor... or does it do that automatically? I'm not sure.
In Java it's just "super()"
A summarized example of what I'm trying to do:
class shape
{
public:
shape(float width, float height)
{
m_width = width;
m_height = height;
}
protected:
float m_width, m_height;
}
class oval:
{
public:
oval()
{
m_num_of_vertices = 20;
// do the shape constructor
}
protected:
float m_num_of_vertices;
}
VC++ won't even let me make another constructor for the class that inherits from shape(). Why?
Thanks for any feedback you have time to give,
-NeXius