fork download
  1. //Typendeklaration
  2. class Car;
  3.  
  4. //Typendefinition
  5. struct Service
  6. {
  7. int Get(const Car&) const;
  8. };
  9. class Car
  10. {
  11. friend int Service::Get(const Car&) const;
  12. int Distance;
  13. };
  14.  
  15. //Funktionsdefinition
  16. int Service::Get(const Car& C) const
  17. {
  18. return C.Distance;
  19. }
  20.  
  21. //Hauptfunktion
  22. int main()
  23. {
  24. Car MyCar;
  25. Service MyService;
  26. int MyDistance = MyService.Get(MyCar);
  27. }
Success #stdin #stdout 0.02s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty