Will you help me ?

class student
{
protected :
int id;
string name;
public:
student(int i, string n)
{
id=i;
name=n;
}
};
class salesman :public student
{
double salary;
public:
salesman (int i,string n, double sl)
:student (i,n)
{
salary=sl;}
void read()
{
cout<<"Enter infor:";
cin>>id>>name>>salary;
}
};

#include <vector>
#include <typeinfo>
#include <iostream >
using namespace std;
void main()
{

salesman sa(8,"Aa",7.0);

vector <student*>s(2);
s[0]=&sa;
for(size_t i=0;i<s.size();i++)
{
salesman *sptr=dynamic_cast <salesman*>(s[i]);
cout<<sptr;}
}


hello .can you tell me whats the output here ,I think the sptr will be "0" is my answer right or no plz I need help :(
you will not have any output because it will not compile.

Topic archived. No new replies allowed.