problem when trying to inherit from EthernetClient class
hello,
i'm trying create new class inherits ethernetclient class, in order add specific functions parse http commands needs. , can't manage have working.
initially, had code such as:
now, make get_http_request() function method of new class inherit ethernetclient, like:
and above code become somthing like:
but when doing this, following compilation error:
so then, tried do:
this time got following compilation error:
so then, tried add constructor in new class:
this time, got no compilation error, doesn't work before, "if (client) {" of loop function never succeeds.
could explain me problem in way try extend base class?
thanks , regards,
michael
i'm trying create new class inherits ethernetclient class, in order add specific functions parse http commands needs. , can't manage have working.
initially, had code such as:
code: [select]
void loop() {
ethernetclient client = server.available();
if (client) {
get_http_request(client);
....
}
}
now, make get_http_request() function method of new class inherit ethernetclient, like:
code: [select]
class myethernetclient : public ethernetclient {
public:
string gethttprequest();
};
myethernetclient::gethttprequest() {
...}
and above code become somthing like:
code: [select]
void loop() {
myethernetclient client = server.available();
if (client) {
cmdstring = client.gethttprequest();
....
}
}
but when doing this, following compilation error:
quote
error: conversion 'ethernetclient' non-scalar type 'myethernetclient' requested
so then, tried do:
code: [select]
myethernetclient client = (myethernetclient) server.available();
this time got following compilation error:
quote
error: no matching function call myethernetclient::myethernetclient(ethernetclient)
so then, tried add constructor in new class:
code: [select]
class myethernetclient : public ethernetclient {
public:
myethernetclient (ethernetclient client) : ethernetclient() {};
string gethttprequest();
};
this time, got no compilation error, doesn't work before, "if (client) {" of loop function never succeeds.
could explain me problem in way try extend base class?
thanks , regards,
michael
... , sorry long message way.
Arduino Forum > Using Arduino > Programming Questions > problem when trying to inherit from EthernetClient class
arduino
Comments
Post a Comment