using a function of a class in another class

Hi
i have a problem

i have a class with some functions and a constructor witch does a lot of things,
i want to use some of the functions in another class,
with inheritance the constructor stars working and i dont want this to happen
with friendship, it says it's the first use this function(i used class friendship and function friendship, both with a same result)

how can i do this?
again without the constructor of the first class starting.

this is a part of my code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class SignupCoourse;

  class SignUpProfessor: public SignUp
{
      friend class SignUpCourse;
protected:
          long long int PID;
public:
       SignUpProfessor();
       ~SignUpProfessor();
       void SetPID();
};
class SignUpCourse
{
protected:
         //some arguments 


public:
       SignUpCourse();
       ~SignUpCourse();
       //some functions
};
SignUpCourse::SignUpCourse()
{
                 CurrentFile.open("course.txt");
                 CurrentFile<<"\n";
                 //calling some functions
                 SetPID();
}
Line 5 introduces name SignUpCourse. Line 1 did mention SignupCourse.

However, whose SetPID() do you call? It is a member, so it requires an object of type SignUpProfessor. We can only guess that SetPID() modifies member PID of one specific object.

Furthermore, SetPID() is already public, so no friendship is required.
Topic archived. No new replies allowed.