I want to make a pure virtual class that other classes inherit from it and each class implements the same function but with different implementation: let say I implement class Server
class Server
{
Server();
~Server()=0;
virtual void send(const std::string& string);
virtual std::string resive();
};
class TcpServer:public Server
{
TcpServer();
~TcpServer();
void send(const std::string& string)
{...}
std::string resive(){...}
};
class UdpServer : public Server
{
UdpServer ();
~UdpServer ();
void send(const std::string& string)
{...}
std::string resive(){...}
};
main()
{
Server* server = new TcpServer()/UdpServer;
}
How does this Design Pattern call? because I don't understand if it Adapter or Composite or Facade and if you have a different idea of how to implement this behavior.
Aucun commentaire:
Enregistrer un commentaire