This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
cpp:acccess_modifiers [2020/04/08 10:49] gthanos |
cpp:acccess_modifiers [2021/05/18 06:37] (current) |
||
|---|---|---|---|
| Line 24: | Line 24: | ||
| protected: | protected: | ||
| int color; | int color; | ||
| + | public: | ||
| + | int borderWidth; | ||
| public: | public: | ||
| Cuboid(int w, int h, int l); | Cuboid(int w, int h, int l); | ||
| Line 69: | Line 71: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | Η δήλωση < | ||
| <code cpp CubeUsage.cpp> | <code cpp CubeUsage.cpp> | ||
| Line 76: | Line 80: | ||
| Cuboid cuboid(1, | Cuboid cuboid(1, | ||
| // | // | ||
| + | cuboid.borderWidth = 5; | ||
| + | | ||
| Cube cube(1, 0xcccccc); | Cube cube(1, 0xcccccc); | ||
| cuboid.setWidth(5); | cuboid.setWidth(5); | ||
| Line 86: | Line 92: | ||
| - Τα πεδία //width//, //height// και //length// της κλάσης //Cuboid// είναι ορισμένα ως //private// και δεν είναι ορατά από τη συνάρτηση //main// ή την κλάση // | - Τα πεδία //width//, //height// και //length// της κλάσης //Cuboid// είναι ορισμένα ως //private// και δεν είναι ορατά από τη συνάρτηση //main// ή την κλάση // | ||
| - Το πεδίο //color// είναι ορισμένο ως // | - Το πεδίο //color// είναι ορισμένο ως // | ||
| - | - Η μέθοδος // | + | - Η μέθοδος // |
| </ | </ | ||