cpp:friend_methods
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
cpp:friend_methods [2017/04/20 15:58] – [Φιλικές Κλάσεις] gthanos | cpp:friend_methods [2017/04/20 16:09] – gthanos | ||
---|---|---|---|
Line 61: | Line 61: | ||
public: | public: | ||
Rectangle(int w, int h); | Rectangle(int w, int h); | ||
+ | Rectangle() {} | ||
void setWidth(int w); | void setWidth(int w); | ||
void setHeight(int h); | void setHeight(int h); | ||
Line 89: | Line 90: | ||
Cuboid(Rectangle r, int l); | Cuboid(Rectangle r, int l); | ||
int volume(); | int volume(); | ||
- | } | + | }; |
Cuboid:: | Cuboid:: | ||
Line 96: | Line 97: | ||
int Cuboid:: | int Cuboid:: | ||
- | return | + | return |
} | } | ||
</ | </ | ||
Line 102: | Line 103: | ||
<code cpp CuboidVolume.cpp> | <code cpp CuboidVolume.cpp> | ||
#include < | #include < | ||
+ | using namespace std; | ||
+ | |||
+ | #include " | ||
int main() { | int main() { | ||
Rectangle rectangle(5, | Rectangle rectangle(5, | ||
- | Cuboid cuboid(r, 10); | + | Cuboid cuboid(rectangle, 10); |
cout << " | cout << " | ||
} | } | ||
</ | </ |
cpp/friend_methods.txt · Last modified: 2021/05/18 06:21 (external edit)