If a constructor calls another class with another constructor and both constructors have methods that access the same class, which would be first?

First constructor in a method separate from the class

{
    Entry entry(" ", " ", " ", time.Hours(), 
                time.Minutes());
    return !(list.IsPresent(entry));
}

Second constructor that it's calling.

Entry::Entry( /* in */ string firstName,    
              /* in */ string middleName,   
              /* in */ string lastName,       
              /* in */ int  initHours,     
              /* in */ int  initMinutes)  
    // Constructor initializers
    : name(firstName, middleName, lastName), 
      time(initHours, initMinutes)

I'm just confused with how time.Hours() & time.Minutes would be called before or after time(initHours, initMinutes) in the second constructor.

Thanks.

Recommended Answers

All 2 Replies

If I am right, you want to know which comes first?
Easy, just put this in all the constructors..

cout<<"constructorname's constructor"<<endl

and you will know ,during runtime, which precedes which.

If this helped, mark this thread as solved and add to m reputation points ,please..Thanks!!

"Show me your code and I will tell you who you are.."-Tkud

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.