cpp:classes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
cpp:classes [2017/05/09 12:30] – [Κλάσεις και Αντικείμενα] gthanos | cpp:classes [2020/04/08 07:35] – gthanos | ||
---|---|---|---|
Line 13: | Line 13: | ||
void setWidth(int w); | void setWidth(int w); | ||
void setHeight(int h); | void setHeight(int h); | ||
- | int getWidth(); | + | int getWidth() |
- | int getHeight(); | + | int getHeight() |
}; | }; | ||
void Rectangle:: | void Rectangle:: | ||
void Rectangle:: | void Rectangle:: | ||
- | int Rectangle:: | + | int Rectangle:: |
- | int Rectangle:: | + | int Rectangle:: |
int main () { | int main () { | ||
Line 59: | Line 59: | ||
<WRAP center round important 80%> | <WRAP center round important 80%> | ||
- | Οι μέθοδοι // | + | Οι μέθοδοι // |
- | + | ||
- | Η δήλωση //const// είναι εξαιρετικά σημαντική όταν θέλουμε να χρησιμοποιήσουμε τη συνάρτηση μέσα σε άλλες συναρτήσεις που είτε **α)** ανήκουν στην ίδια κλάση και δεν μεταβάλλουν το αντικείμενο στο οποίο εφαρμόζονται ή **β)** λαμβάνουν ως όρισμα ένα αντικείμενο της κλάσης το οποίο δεν μεταβάλλεται μέσα στο σώμα τους (λαμβάνουν ως παράμετρο μία αναφορά ή ένα δείκτη σε ένα αντικείμενο τύπου //const//). | + | |
</ | </ | ||
cpp/classes.txt · Last modified: 2021/05/06 23:01 (external edit)