Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Overwriting functions as private July 01, 2010 02:32PM |
Registered: 15 years ago Posts: 84 Rating: 0 |
Language: C++class GeneralHandler : public QXmlDefaultHandler { public: virtual bool startElement(const QString& gName); private: /* * Overides the function of the base class as private and calls the overloaded function startElement(const QString& qName), * in effect hiding the function and the unnecessary parameters. */ bool startElement(const QString&, const QString&, const QString& qName, const QXmlAttributes&); }; bool GeneralHandler::startElement(const QString& I, const QString&, const QString& qName, const QXmlAttributes&) { this->startElement(qName); }
Re: Overwriting functions as private July 01, 2010 03:14PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
[1]Language: C++ (QT)GeneralHandler handler; static_cast<QXmlDefaultHandler >(handler)->startElement("arg1", "arg2", "arg3", "arg4"); // allowed
Re: Overwriting functions as private July 01, 2010 03:37PM |
Registered: 15 years ago Posts: 84 Rating: 0 |
Re: Overwriting functions as private July 01, 2010 04:57PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Language: C++ (QT)// Reimpliments QXmlDefaultHandler::startElement() // Does nothing with namespaceURI, localName and atts. // Does ........ with qName bool startElement(const QString &namespaceURI, const QString &localName, const QString& qName, const QXmlAttributes &atts);
Re: Overwriting functions as private July 01, 2010 07:42PM |
Registered: 15 years ago Posts: 84 Rating: 0 |
Language: HTML<CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <YEAR>1988</YEAR> <PRICE>9.90</PRICE> </CD> </CATALOG>
Language: C++ (QT)bool startElement(const QString &namespaceURI, const QString &localName, const QString& qName, const QXmlAttributes &atts) { //Some functionality }
Someone not so experienced might at first try and figure out where the other parameters come into play. Where if is out of site then it is out of mind.Language: C++ (QT)bool startElement(const QString& qName) { //Some functionality }