Как назначить атрибут, принадлежащий родительскому классу, дочернему классу с помощью конструктора в С++ [дубликат] ⇐ C++
Как назначить атрибут, принадлежащий родительскому классу, дочернему классу с помощью конструктора в С++ [дубликат]
this is my code. I'm new to c++
#include class Human { public: std::string gender; class Foo : public Human { public: std::string name; Foo(std::string gender, std::string name) { this->gender = gender; this->name = name; } }; }; int main(void) { Human::Foo foo("Male", "Foo"); std::cout
Источник: https://stackoverflow.com/questions/780 ... -class-usi
this is my code. I'm new to c++
#include class Human { public: std::string gender; class Foo : public Human { public: std::string name; Foo(std::string gender, std::string name) { this->gender = gender; this->name = name; } }; }; int main(void) { Human::Foo foo("Male", "Foo"); std::cout
Источник: https://stackoverflow.com/questions/780 ... -class-usi
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Использование наследования для добавления родительского класса к дочернему классу
Anonymous » » в форуме Python - 0 Ответы
- 44 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Принадлежит ли сокет, созданный в родительском классе, его дочернему классу?
Anonymous » » в форуме JAVA - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-