User Tools

Site Tools


cpp:friend_methods

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
cpp:friend_methods [2019/04/19 10:07] – [Φιλικές Συναρτήσεις] gthanoscpp:friend_methods [2019/04/19 10:08] – [Φιλικές Κλάσεις] gthanos
Line 50: Line 50:
 Σε αναλογία με τις φιλικές συναρτήσεις μπορείτε να έχετε και φιλικές κλάσεις που έχουν πρόσβαση στο σύνολο των πεδίων κλάσης. Στο παρακάτω παράδειγμα, η κλάση //Cuboid// είναι φιλική της κλάσης //Rectangle//. Ως φιλική κλάση έχει πρόσβαση στο σύνολο των πεδίων και των μεθόδων της κλάσης //Rectangle// Σε αναλογία με τις φιλικές συναρτήσεις μπορείτε να έχετε και φιλικές κλάσεις που έχουν πρόσβαση στο σύνολο των πεδίων κλάσης. Στο παρακάτω παράδειγμα, η κλάση //Cuboid// είναι φιλική της κλάσης //Rectangle//. Ως φιλική κλάση έχει πρόσβαση στο σύνολο των πεδίων και των μεθόδων της κλάσης //Rectangle//
  
-<code cpp Rectangle.cpp>+<code cpp Rectangle.hpp>
 #include <iostream> #include <iostream>
 using namespace std; using namespace std;
Line 77: Line 77:
 </code> </code>
  
-<code cpp Cuboid.cpp>+<code cpp Cuboid.hpp>
 #include <iostream> #include <iostream>
 using namespace std; using namespace std;
  
-#include "Rectangle.cpp"+#include "Rectangle.hpp"
  
 class Cuboid { class Cuboid {
Line 104: Line 104:
 using namespace std; using namespace std;
  
-#include "Cuboid.cpp"+#include "Cuboid.hpp"
  
 int main() { int main() {
cpp/friend_methods.txt · Last modified: 2021/05/18 06:21 (external edit)