Consider the following part of a class. socket is a class variable of type Qudp Socket* and ctr a class variable of type
Posted: Thu May 26, 2022 9:47 am
Consider the following part of a class. socket is a class variable of type Qudp Socket* and ctr a class variable of type int. 1 #include "udpserver.h" 2 #include <QDebug> 3 4 UdpServer :: UdpServer (Q0bject *parent): QObject (parent) 5 { 6 ctr = 0; 7 socket new QUdpSocket (this); 8 socket->bind (QHostAddress:: Any, 7000); 9 connect (socket, SIGNAL (readyRead ()), this, SLOT (read())); 10 } 11 void UdpServer::read() 12 { 13 while (socket->has PendingDatagrams ()) 14 { 15 QNetworkDatagram datagram = socket->receive Datagram (); qDebug() << datagram.data(); 16 17 QByteArray reply socket->writeDatagram "We spoke "+ QByteArray:: number (++ctr) + " times"; (datagram.makeReply(reply)); 18 19 } 20 } (b) Teken 'n klasdiagram wat die oorerwings- en bevattingseienskappe wat uit die kode blyk, toon. Draw a class diagram that displays the inheritance- and containment relationships evi- dent from the code. (8)