-
Notifications
You must be signed in to change notification settings - Fork 45
КМБО 03 21 Поляков А.А. новая ветвь #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LexichWhyNot
wants to merge
6
commits into
grayed:master
Choose a base branch
from
LexichWhyNot:КМБО-03-21_ПоляковАА_новая_ветвь
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "\u041A\u041C\u0411\u041E-03-21_\u041F\u043E\u043B\u044F\u043A\u043E\u0432\u0410\u0410_\u043D\u043E\u0432\u0430\u044F_\u0432\u0435\u0442\u0432\u044C"
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,15 @@ | ||
| #include "animal.h" | ||
|
|
||
| #include <sstream> | ||
| #include <iostream> | ||
| using namespace std; | ||
|
|
||
| int main() { | ||
| return 0; | ||
| Cat Scottish(5); | ||
| Horse Spirit(1234); | ||
| Scottish.set_MiceCaughtCounter(7); | ||
| Spirit.setkilometresRun(1500.5); | ||
| int res = Scottish.get_MiceCaughtCounter(); | ||
| float res2 = Spirit.get_kilometresRun(); | ||
| cout << res << " " << res2 << "\n"; | ||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,84 @@ | ||
| #pragma once | ||
|
|
||
| #include <iostream> | ||
| #include <sstream> | ||
| using namespace std; | ||
|
|
||
|
|
||
| class Animal { | ||
| private: | ||
| bool CanMoveFreely; | ||
| protected: | ||
| Animal() { CanMoveFreely = 0; } | ||
| Animal(bool YesOrNo) { CanMoveFreely = YesOrNo; } | ||
| public: | ||
|
|
||
| void setCanMoveFreely(bool YesOrNo) { CanMoveFreely = YesOrNo; } | ||
| bool get_CanMoveFreely() const { return CanMoveFreely; } | ||
| virtual string about() const { return (stringstream() << "CanMoveFreely =" << CanMoveFreely).str(); } | ||
|
|
||
| }; | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Нет перегрузки операции вывода в поток для |
||
|
|
||
| class Mammal :public Animal { | ||
| private: | ||
| bool FeedsWithMilk; | ||
| protected: | ||
| Mammal() { FeedsWithMilk = 0; } | ||
| Mammal(bool FeedOrNot) { FeedsWithMilk = FeedOrNot; } | ||
| public: | ||
| void setFeedsWithMilk(bool FeedOrNot) { FeedsWithMilk = FeedOrNot; } | ||
| bool get_FeedsWithMilk() const { return FeedsWithMilk; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << "FeedsWithMilk =" << FeedsWithMilk).str(); } | ||
| }; | ||
|
|
||
| class Cat :public Mammal { | ||
| private: | ||
| int MiceCaughtCounter; | ||
|
|
||
| public: | ||
| float weight; // kg | ||
| Cat(int MiceCaught) { MiceCaughtCounter = MiceCaught; } | ||
| void set_MiceCaughtCounter(int MiceCaught) { MiceCaughtCounter = MiceCaught; } | ||
| int get_MiceCaughtCounter() const { return MiceCaughtCounter; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << Mammal::about() << ", " << "MiceCaughtCounter =" << MiceCaughtCounter).str(); } | ||
| }; | ||
|
|
||
| class Mammal : public Animal { | ||
| class Horse :public Mammal { | ||
| private: | ||
| float kilometresRun; | ||
| public: | ||
| float pregnancyDuration; // days | ||
| Horse(float distance) { kilometresRun = distance; } | ||
| void setkilometresRun(float distance) { kilometresRun = distance; } | ||
| float get_kilometresRun() const { return kilometresRun; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << Mammal::about() << ", " << "kilometresRun =" << kilometresRun).str(); } | ||
| }; | ||
|
|
||
| class Cat : public Mammal { | ||
|
|
||
| class Birds : public Animal { | ||
| private: | ||
| int FeathersCounter; | ||
| protected: | ||
| Birds() { FeathersCounter = 0; } | ||
| Birds(int Feathers) { FeathersCounter = Feathers; } | ||
| public: | ||
| float vibrissaLength; // meters | ||
| void setFeathersCounter(int Feathers) { FeathersCounter = Feathers; } | ||
| int get_FeathersCounter() const { return FeathersCounter; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << "FeathersCounter =" << FeathersCounter).str(); } | ||
| }; | ||
| class Pigeon :public Birds { | ||
| private: | ||
| bool CanBegForBread; | ||
| public: | ||
| Pigeon(int CheekyOrNot) { CanBegForBread = CheekyOrNot; } | ||
| bool get_CanBegForBread() const { return CanBegForBread; } | ||
| void setCanBegForBread(int CheekyOrNot) { CanBegForBread = CheekyOrNot; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << Birds::about() << ", " << "CanBegForBread =" << CanBegForBread).str(); } | ||
| }; | ||
| class Caliber :public Birds { | ||
| private: | ||
| int WingBeatSpeedPerSecond; | ||
| public: | ||
| Caliber(int BeatCounter) { WingBeatSpeedPerSecond = BeatCounter; } | ||
| int get_WingBeatSpeedPerSecond() const { return WingBeatSpeedPerSecond; } | ||
| void setWingBeatSpeedPerSecond(int BeatCounter) { WingBeatSpeedPerSecond = BeatCounter; } | ||
| virtual string about() const { return (stringstream() << Animal::about() << ", " << Birds::about() << ", " << "WingBeatSpeed =" << WingBeatSpeedPerSecond).str(); } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,30 @@ | ||
| #pragma once | ||
|
|
||
| #include <ostream> | ||
| #include <string> | ||
|
|
||
| class B; // чтобы можно было объявить printInternals() как friend в классе A | ||
|
|
||
| class A { | ||
| std::string a_s; | ||
| int foo; | ||
|
|
||
| friend void printInternals(const B&); | ||
| friend void printInternals(B& b); | ||
|
|
||
| public: | ||
| A(); | ||
| std::string getBString() const; | ||
| virtual float getBData(int idx) const; | ||
| void printData(std::ostream& os); | ||
| void printData2(std::ostream& os); | ||
| virtual float* getBData() = 0; | ||
| }; | ||
|
|
||
| class B : public A { | ||
| std::string b_s; | ||
| float data[7]; | ||
|
|
||
| friend void printInternals(const B&); | ||
| friend void printInternals(B& b); | ||
|
|
||
| public: | ||
| B(); | ||
|
|
||
| std::string getBString() const; | ||
| virtual float getBData(int idx) const; | ||
| }; | ||
|
|
||
| void printInternals(const B& b); | ||
| void printInternals(B& b); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не выполнен пункт задания с использованием
protected.