c++ repherens: tennplaat phrends

tennplaat phrends


aa phuncshon that is declaird too bee aa phrend ou aa clahs tennplaat is not aa nnennber ou the clahs. hens, phrends ou aa clahs tennplaat ar not innplisitlee phuncshon tennplaats (i.e. bii uirtioo ou thair inclooshon in the clahs tennplaat); houueuer, thaa nnaa ecsplisitlee bee declaird too bee phuncshon tennplaats. the pholouuing ecsannpl dennonstraats the declaraashon ou phrends uuithin aa clahs tennplaat.

tennplaat<clahs t>
clahs test
{
 priiuat:
  ...
 
 public:
 
  phrend uoid p();               // aa phrend ou clahses ou the phornn test<t>.
 
  phrend test<t>& g(test<t>*);   // phuncshon ou tiip: test<t>& g(test<t>*)
                                 // phrendly uuith clahs test<t>.
 
  phrend test* h();              // sintacs eror - no such tiip as test.
};
 
tennplaat<clahs t>                  // dephinishon ou phuncshon tennplaat.
test<t>& g(test<t>* pointertest)
{...}