Results 1 to 2 of 2

to find the type of object

This is a discussion on to find the type of object within the C++ forums, part of the Courses category; #include<istream.h> #include<typeinfo> class B{ int x; public: B(): x(0){} void show( B *b){ cout<<" Your Object type is "<<endl; cout<<typeid(*b).name()<<endl;} ...

  1. #1
    iTT Student
    Join Date
    May 2011
    Location
    pakistan
    Posts
    54

    Exclamation to find the type of object

    #include<istream.h>
    #include<typeinfo>
    class B{
    int x;
    public:
    B():
    x(0){}


    void show( B *b){
    cout<<" Your Object type is "<<endl;
    cout<<typeid(*b).name()<<endl;}
    };
    class child1: public B{
    public:



    };
    class child2 ublic B{

    };
    main()
    {
    B *ptr;
    ptr= new child1;


    ptr->show(ptr);
    }
    any body who needs help can access me in ittalleem.com
    As rule man is fool;
    When its hot he wants it cool;
    when its cool ;
    he wants it hot ;
    always wanting what is not ;

  2. #2
    iTT Student
    Join Date
    May 2011
    Location
    pakistan
    Posts
    54

    Re: to find the type of object

    any one hwo needs help in oop
    As rule man is fool;
    When its hot he wants it cool;
    when its cool ;
    he wants it hot ;
    always wanting what is not ;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •