As the title states: when I “derive” a class in CPP, that’s pretty much the same thing as “extending” a class in Java, yes?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. Since Java doesn’t have multiple inheritance, it can be a bit more verbose with the language. Java’s
class D extends Bisclass D : public Bin C++, but in C++ you can also have inheritances likestruct D : B1, private B2, protected B3.Similarly, in Java
superrefers to the (unique) base subobject, and understandably there is no comparable concept in C++ (you have to specify the base by name).(Note that there’s also
implementsin Java for dedicated interface classes. Since those have no members and only abstract functions, there’s no need to refer to those interface bases from the derived (i.e. “implementing”) class.)