finding the longest name in a class
<p>i have 3 classes human,teacher and student, teacher and student inherits the properties of human my classes are like this below</p>

<pre><code>class human{
        public:
        string firstname;
        string lastname;

}

class teacher:public human{
        public:
        int card_number;
}

class student:public human{
        public:
        int studen_num;
}
</code></pre>

<p>i want to write a function that compares the lastnames of the <code>teachers</code> and that of <code>students</code>,then it should print the one with the longest name with the help of an array,how can i do this ??thanks in advance</p>

<p>this is what i tried</p>

<pre><code>void st(students1,teachers2){
if (str_length(s1.name) &gt; str_length(s2.name))
   cout&lt;&lt;s1.name;
   else
   cout&lt;&lt;s2.name;

}
</code></pre>

<p>i do not know how i can do it with arrays</p>
