0

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.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Trekker182
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.