This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: create an object with variable CLASS
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.
///////////////////////////////////////////////////////////////////////////////////////////
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");};
};
//////////////////////////////////////////////////////////////////////////////////////////////