Re: create an object with variable CLASS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



printg == dosomthing
base == x
Base == module_management
On Tue, 2009-10-27 at 12:01 +0100, Axel Freyn wrote:
> On Wed, Oct 28, 2009 at 02:26:18AM +0330, Mohsen Pahlevanzadeh wrote:
> > On Tue, 2009-10-27 at 10:49 +0000, Andrew Haley wrote:
> > > Mohsen Pahlevanzadeh wrote:
> > > > i define an object from class base & call dosomthing & get gollowing
> > > > error:
> > > > request for member ‘dosomthing’ in ‘base’, which is of non-class type
> > > > ‘Base*’
> > > 
> > > Please post the source.
> > > 
> > > Andrew.
> That's not the correct source - in your source, the function
> "dosomthing" is nowhere defined!
> Nevertheless: "base" is a pointer ("of non-class type 'Base*'"), so you
> have to use:
> "base->dosomthing()" and NOT "base.dosomthing()"
> Are you doing that?
> 
> Axel
> > ///////////////////////////////////////////////////////////////////////////////////////////
> > module_management* create_object(char * class_name){
> >         if (c_find(class_name) == NULL){
> > 	        if (strcmp (class_name,"mikrotik") == 0)
> >         	        return  new mikrotik;
> >         }
> >         
> > 
> > }
> > /////////////////////////////////////////////////////////////////////////////////////////////
> > class module_management{ ///This is base class
> >         public:
> >         //      list<modules> modules_list;
> >         //      list<modules>::iterator it;
> >                 module_management();
> >         //      char * classes[20][4];  
> >                 char *section,*ipaddr,*hostname,*username,*password;
> >                 virtual void printg() = 0; //THIS IS RECOMMENDED OF AXEL
> >                 //FILE *fptr;
> >                 bool config_file_processor( char *str);
> >                 bool set_classes( char * class_name);// set classes
> > array (append to classes array)
> >                 bool is_classes( char *class_name);//search classes
> > array for the class
> >                 module_management *create_object( char *class_name) ; //
> > Loading a module
> >                 bool delete_classes(char *class_name); //delete a class
> > from claases array for using in unload_module method
> >                 bool unload_module( char *class_name);//unloading the
> > module
> > 
> > };//end of module_management class
> > //////////////////////////////////////////////////////////////////////////////////////////////////
> > class mikrotik:public module_management{
> >         public:
> >                 void printg(){printf ("saaaaaaaaaalaaaaaaaaaaam");};
> > };
> > 
> > 
> > 
> > 
> > 
> > 
> > //////////////////////////////////////////////////////////////////////////////////////////////



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux