hiya guys i have what will probably be a trivial problem for you.
i have a base class and a sub class the base constructor takes args but the sub dosent need them here is a little code to help explain my problem
my problem is how to construct a subclass this is what i have tried but doesnt work yetCode:class base
{
base(int x,int y);
xPos;
yPos;
}
class sub : base
{
sub();
xVel;
yVel;
}
sub::sub()
{
xVel=0;
yVel=0;
}
base::base(int x,int y)
{
xPos=x;
yPos=y;
}
ok so i know im doing something wrong but as a begginer in lost as to what that is any help would be appreciated thanks in advance :)Code:sub(int x,int y) // change sub's constructor to this
sub::sub(int x,int y) : base(x,y)
{
xVel=0;
yVel=0;
}
to clarify this isnt my actual classes but a representation of the real code to make it easier to read