Вход на сайт
Воспоминания Си Джи Ай 15.02.2025
54 просмотров
Перейти к просмотру всей ветки
в ответ uscheswoi_82 3 дня назад, 09:07
Подправлю. Вместо void Request::setContentType(string strContentType) надо писать void Request::setContentType(string strContentType). Это только в C# и VB NET принято писать так void Request::setContentType(string strContentType). А в Си++, PHP, и Java пишут так set_...() или get_...() и всё маленькими буквами!
Request.hpp:
#ifndef _REQUEST #define _REQUEST #include <iostream> #include <string> using namespace std; class Request { private: string strContentType; public: Request(); void set_content_type(string strContentType); string get_method(); string get_query(); string get_uri(); string get_cookies(); }; #endif
Request.cpp:
#include "request.hpp" void Request::set_content_type(string strContentType) { this->strContentType = strContentType; cout << "Content-Type:" << strContentType << "\n\r" << endl; } string Request::get_method() { return getenv("REQUEST_METHOD"); } string Request::get_query() { return getenv("QUERY_STRING"); } string Request::get_uri() { return getenv("REQUEST_URI"); } string Request::get_cookies() { return getenv("HTTP_COOKIE"); }
Если я кому-то отвечаю, это не значит что я ему симпатизирую, каждый остаётся при своём мнение