Suppose a class Childis a derived class of a class Parent. In the five file program, how would I indicate in Child.hthat I want to call the constructor Parent? I don't think there is anything like the following in the header:
Child
Parent
Child.h
Child(int Param, int ParamTwo) : Parent(Param);
In this situation, what should the constructor syntax look like Child.cpp?
Child.cpp
In Child.h, you simply declare:
Child(int Param, int ParamTwo);
In Child.cpp you will have:
Child::Child(int Param, int ParamTwo) : Parent(Param) { //rest of constructor here }
.
class Child : public Parent { // ... Child(int Param, int ParamTwo) : Parent(Param) { /* Note the body */ } };
class Child : public Parent { // ... Child(int Param, int ParamTwo); };
(Child.cpp)
Child::Child(int Param, int ParamTwo) : Parent(Param) { }
Source: https://habr.com/ru/post/1543293/More articles:Find self-referencing code in IntelliJ - intellij-ideaDon't set a lot of interesting associations in Spring Data Rest - javaTrim text from OpenCV C ++ binary image - c ++reading USGS Digital Elevation (DEM) data in ArcGrid, GridFloat, and IMG formats - geospatialmongoimport 2.6 против 2.4 - mongodbКак выровнять ярлык и выбрать поле по вертикали (в середине) - cssHow to get Hibernate to reuse or recreate temporary tables during bulk updates - javaWindows form controls are gone - c #How to create a view of a table containing a timestamp column? - google-bigqueryAre IIS7 cache files (mp4 / wmv) used? - cachingAll Articles