An abstract class in C can be inherited

Inheritance with an abstract class

Hi guys,

I actually come from Vulkaan Island (Java) and there the story of inheritance is totally clear to me and also as far as the syntax is concerned ...

Unfortunately I am not 100% clear with the syntax in C ++ ...

So this is what I plan to do now:

There is an abstract class boat with the attribute bg (boat weight), a class motorboat with the attribute ml (engine power) and a class sailboat with the attributes sf (sail area) and wg (wind speed) ... The classes motorboat and sailboat should of course inherit from the class boat and realize it ...

I wasn't sure how to create an abstract class in C ++, but there are some examples in Inet, unfortunately most of the examples contain only one method in the class and no attribute ...

My class looks like this:

Boot.h

My other two classes look like this:

Motorboat.h

Motorboat.cpp

<< ICH WERDE DIE KLASSE SEGELBOOT HIER NICHT REINSTELLEN WEIL ES JA EIGENTLICH ÄQUIVALENT IST >>

What I don't like at this point is that I cannot initialize the bg attribute of the Motorboot constructor via the initialization list ...
I have to initialize it in the block ...
Surely it has to work differently, or what is the common way of doing it in C ++?

So if I write a little main now and want to create a motorboat, it looks like this for me:

main.cpp

As soon as I let that run, I get an error in line 9 that tells me:
Variable type "Motorboat" is an abstract class

Why is the motorboat abstract now? : S.

So I'm sure the error is somehow in the syntax or in the way you implement it in C ++ ...

Can someone help me or give me tips?

Thanks!