欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++?面向?qū)ο笊钊虢馕?/h1>
 更新時(shí)間:2023年11月23日 09:47:14   作者:xclic  
C++?面向?qū)ο缶幊蹋∣OP)是語言的核心特性,通過封裝、繼承、多態(tài)三大支柱實(shí)現(xiàn)代碼復(fù)用、模塊化和可擴(kuò)展性,本文給大家介紹C++?面向?qū)ο蟮南嚓P(guān)知識,感興趣的朋友跟隨小編一起看看吧

C++ 面向?qū)ο缶幊蹋∣OP)是語言的核心特性,通過封裝、繼承、多態(tài)三大支柱實(shí)現(xiàn)代碼復(fù)用、模塊化和可擴(kuò)展性。

1、三大特性

1.1 封裝

將數(shù)據(jù)(成員變量)和操作數(shù)據(jù)的方法(成員函數(shù))捆綁在類中,通過訪問控制符限制外部對內(nèi)部數(shù)據(jù)的直接訪問,僅暴露必要接口。

隱藏實(shí)現(xiàn)細(xì)節(jié),確保數(shù)據(jù)安全性(避免意外修改)。

C++ 通過 public、private、protected 控制成員的可見性:

  • public:類內(nèi)外均可訪問(暴露的接口)。
  • private:僅類內(nèi)及友元可訪問(隱藏的實(shí)現(xiàn)細(xì)節(jié))。
  • protected:類內(nèi)、友元及派生類可訪問(用于繼承場景)。
class BankAccount {
private:
    // 私有數(shù)據(jù)(隱藏,外部無法直接訪問)
    string account_id;
    double balance; 
public:
    // 公有接口(暴露給外部的操作)
    BankAccount(string id, double init_balance) 
        : account_id(id), balance(init_balance) {}
    void deposit(double amount) { // 存款(僅允許通過接口修改)
        if (amount > 0) balance += amount;
    }
    double get_balance() const { // 查詢余額(只讀接口)
        return balance;
    }
private:
    // 私有方法(內(nèi)部實(shí)現(xiàn),不暴露)
    void log_transaction() { 
        // 記錄交易日志(細(xì)節(jié)隱藏)
    }
};
int main() {
    BankAccount acc("12345", 1000);
    acc.deposit(500); // 正確:通過公有接口操作
    cout << acc.get_balance() << endl; // 正確:通過接口查詢
    // acc.balance = 2000; // 錯(cuò)誤:private 成員不可直接訪問
    return 0;
}

問題:封裝的主要優(yōu)點(diǎn)是什么?

  • 數(shù)據(jù)隱藏:保護(hù)內(nèi)部狀態(tài)不被意外修改
  • 實(shí)現(xiàn)隔離:可以修改內(nèi)部實(shí)現(xiàn)而不影響外部代碼
  • 接口標(biāo)準(zhǔn)化:提供清晰的使用方式
  • 增強(qiáng)安全性:通過驗(yàn)證邏輯保護(hù)數(shù)據(jù)完整性

1.2 繼承

從已有類(基類 / 父類)派生出新類(派生類 / 子類),子類自動繼承父類的成員(變量和函數(shù)),并可擴(kuò)展新功能或重寫父類方法。
代碼復(fù)用(避免重復(fù)實(shí)現(xiàn)),建立類之間的層次關(guān)系。

繼承方式與訪問權(quán)限

繼承方式(public/private/protected)會改變基類成員在派生類中的可見性:

  • 公有繼承:基類的public→派生類public,protected→protected
  • 保護(hù)繼承:基類的public和protected→派生類protected
  • 私有繼承:基類的public和protected→派生類private

默認(rèn)繼承方式class 默認(rèn) private 繼承,struct 默認(rèn) public 繼承(建議顯式指定)。

// 基類
class Shape {
protected: // 受保護(hù)成員,派生類可訪問
    std::string name;
    int x, y;
public:
    Shape(const std::string& n, int xPos, int yPos) 
        : name(n), x(xPos), y(yPos) {}
    virtual void draw() const {
        std::cout << "Drawing " << name << " at (" << x << ", " << y << ")" << std::endl;
    }
    virtual double area() const = 0; // 純虛函數(shù),使Shape成為抽象類
    virtual ~Shape() {} // 虛析構(gòu)函數(shù),確保正確釋放資源
};
// 公有繼承 - "是一個(gè)"關(guān)系
class Circle : public Shape {
private:
    double radius;
public:
    Circle(int xPos, int yPos, double r) 
        : Shape("Circle", xPos, yPos), radius(r) {}
    void draw() const override {
        std::cout << "Drawing Circle with radius " << radius 
                  << " at (" << x << ", " << y << ")" << std::endl;
    }
    double area() const override {
        return 3.14159 * radius * radius;
    }
};
// 保護(hù)繼承 - 不常用
class ProtectedBase {
public:
    int publicVar;
protected:
    int protectedVar;
};
class Derived : protected ProtectedBase {
    // publicVar 和 protectedVar 在Derived中都變成protected
};
// 私有繼承 - "實(shí)現(xiàn)為"關(guān)系
class Stack : private std::vector<int> {
public:
    void push(int value) {
        this->push_back(value); // 使用基類的實(shí)現(xiàn)
    }
    int pop() {
        if (!this->empty()) {
            int value = this->back();
            this->pop_back();
            return value;
        }
        throw std::runtime_error("Stack is empty");
    }
    // 使用using恢復(fù)訪問權(quán)限
    using std::vector<int>::empty;
    using std::vector<int>::size;
};

1.3 多態(tài)

同一接口(如函數(shù)名)在不同對象上表現(xiàn)出不同行為。C++ 多態(tài)分為 靜態(tài)多態(tài)(編譯期)和 動態(tài)多態(tài)(運(yùn)行期)。

靜態(tài)多態(tài)(編譯期多態(tài))

  • 通過 函數(shù)重載 或 模板 實(shí)現(xiàn),編譯器在編譯期確定調(diào)用哪個(gè)函數(shù)。
  • 函數(shù)重載:同一作用域內(nèi),函數(shù)名相同但參數(shù)列表(類型 / 個(gè)數(shù) / 順序)不同。
class Math {
public:
    int add(int a, int b) { return a + b; }
    double add(double a, double b) { return a + b; } // 重載(參數(shù)類型不同)
};

模板:通用函數(shù) / 類,編譯器根據(jù)實(shí)參類型生成具體版本。

template <typename T>
T add(T a, T b) { return a + b; }
int main() {
    add(1, 2); // 生成 int 版本
    add(3.14, 2.7); // 生成 double 版本
}

動態(tài)多態(tài)(運(yùn)行期多態(tài))

  • 通過 虛函數(shù)(virtual) 實(shí)現(xiàn),程序運(yùn)行時(shí)根據(jù)對象實(shí)際類型確定調(diào)用的函數(shù)(核心是 “遲綁定”)。

動態(tài)多態(tài)的實(shí)現(xiàn)條件

  • 基類聲明虛函數(shù)(virtual 關(guān)鍵字)。
  • 派生類重寫(override)該虛函數(shù)(函數(shù)簽名必須完全一致)。
  • 通過 基類指針或引用 調(diào)用虛函數(shù)。
class Animal {
public:
    virtual void speak() const { cout << "Animal speaks"; } // 虛函數(shù)
    virtual ~Animal() {} // 虛析構(gòu)(避免內(nèi)存泄漏)
};
class Dog : public Animal {
public:
    void speak() const override { cout << "Dog barks"; } // 重寫
};
class Cat : public Animal {
public:
    void speak() const override { cout << "Cat meows"; } // 重寫
};
int main() {
    Animal* a1 = new Dog();
    Animal* a2 = new Cat();
    a1->speak(); // 運(yùn)行時(shí)綁定:輸出 "Dog barks"
    a2->speak(); // 運(yùn)行時(shí)綁定:輸出 "Cat meows"
    delete a1; // 調(diào)用 Dog 析構(gòu) + Animal 析構(gòu)
    delete a2; // 調(diào)用 Cat 析構(gòu) + Animal 析構(gòu)
    return 0;
}

動態(tài)多態(tài)的底層原理:虛函數(shù)表(vtable)與虛指針(vptr)

  • 虛函數(shù)表(vtable):每個(gè)包含虛函數(shù)的類會生成一個(gè)全局唯一的 vtable(數(shù)組),存儲該類所有虛函數(shù)的地址。
  • 虛指針(vptr):類的每個(gè)對象會隱含一個(gè) vptr 成員,指向該類的 vtable。
  • 重寫機(jī)制:派生類重寫虛函數(shù)時(shí),會替換 vtable 中對應(yīng)位置的函數(shù)地址(基類 vtable 不變)。
  • 調(diào)用過程:通過基類指針調(diào)用虛函數(shù)時(shí),先通過 vptr 找到 vtable,再調(diào)用對應(yīng)地址的函數(shù)(運(yùn)行時(shí)確定)。

2、重要概念

2.1 純虛函數(shù)與抽象類

  • 純虛函數(shù):聲明時(shí)初始化為 0 的虛函數(shù)(virtual return_type func() = 0;),無實(shí)現(xiàn),僅作為接口。
  • 抽象類:包含純虛函數(shù)的類,不能實(shí)例化,只能作為基類被繼承(派生類必須實(shí)現(xiàn)純虛函數(shù)才能實(shí)例化)。
class Vehicle { // 抽象類
public:
    virtual void run() = 0; // 純虛函數(shù)(接口)
};
class Car : public Vehicle {
public:
    void run() override { cout << "Car runs"; } // 必須實(shí)現(xiàn)
};
// Vehicle v; // 錯(cuò)誤:抽象類不能實(shí)例化
Car c; // 正確:已實(shí)現(xiàn)純虛函數(shù)

2.2 this 指針

每個(gè)非靜態(tài)成員函數(shù)都隱含一個(gè) this 指針,指向當(dāng)前對象(函數(shù)所屬的實(shí)例)。

區(qū)分成員變量與函數(shù)參數(shù)(同名時(shí)),返回當(dāng)前對象的引用。

class Person {
private:
    string name;
public:
    Person(string name) { 
        this->name = name; // this 區(qū)分成員變量與參數(shù)
    }
    Person& set_name(string name) {
        this->name = name;
        return *this; // 返回當(dāng)前對象(支持鏈?zhǔn)秸{(diào)用)
    }
};
int main() {
    Person p("Alice");
    p.set_name("Bob").set_name("Charlie"); // 鏈?zhǔn)秸{(diào)用
    return 0;
}

2.3 構(gòu)造函數(shù)和析構(gòu)函數(shù)

  • 構(gòu)造函數(shù): 對象創(chuàng)建時(shí)自動調(diào)用,用于初始化成員變量(與類名同名,無返回值)。
    • 可重載(支持不同初始化方式)。
    • 派生類構(gòu)造函數(shù)必須初始化基類構(gòu)造函數(shù)(通過初始化列表)。
  • 析構(gòu)函數(shù):對象銷毀時(shí)自動調(diào)用,用于釋放資源(如動態(tài)內(nèi)存、文件句柄),格式為~類名()。
    • 若類作為基類且可能被繼承,析構(gòu)函數(shù)必須聲明為 virtual(否則刪除基類指針時(shí)可能泄漏派生類資源)。
class Example {
private:
    int* data;
    size_t size;
public:
    // 1. 默認(rèn)構(gòu)造函數(shù)
    Example() : data(nullptr), size(0) {}
    // 2. 參數(shù)化構(gòu)造函數(shù)
    Example(size_t s) : size(s) {
        data = new int[size]{};
    }
    // 3. 拷貝構(gòu)造函數(shù)
    Example(const Example& other) : size(other.size) {
        data = new int[size];
        std::copy(other.data, other.data + size, data);
    }
    // 4. 移動構(gòu)造函數(shù) (C++11)
    Example(Example&& other) noexcept : data(other.data), size(other.size) {
        other.data = nullptr;
        other.size = 0;
    }
    // 5. 拷貝賦值運(yùn)算符
    Example& operator=(const Example& other) {
        if (this != &other) {
            delete[] data;
            size = other.size;
            data = new int[size];
            std::copy(other.data, other.data + size, data);
        }
        return *this;
    }
    // 6. 移動賦值運(yùn)算符 (C++11)
    Example& operator=(Example&& other) noexcept {
        if (this != &other) {
            delete[] data;
            data = other.data;
            size = other.size;
            other.data = nullptr;
            other.size = 0;
        }
        return *this;
    }
    // 7. 析構(gòu)函數(shù)
    ~Example() {
        delete[] data;
    }
};

2.4 拷貝構(gòu)造與移動構(gòu)造(C++11)

拷貝構(gòu)造函數(shù):用已有對象初始化新對象(類名(const 類名& other)),默認(rèn)淺拷貝(僅復(fù)制指針地址),可能導(dǎo)致 “double free” 問題,需手動實(shí)現(xiàn)深拷貝。

class String {
private:
    char* data;
public:
    // 深拷貝構(gòu)造(避免淺拷貝問題)
    String(const String& other) {
        data = new char[strlen(other.data) + 1];
        strcpy(data, other.data);
    }
};

移動構(gòu)造函數(shù)(C++11+):用臨時(shí)對象(右值)的資源初始化新對象(類名(類名&& other)),轉(zhuǎn)移資源所有權(quán)(避免拷貝,提升性能)。

String(String&& other) noexcept {
    data = other.data; // 直接接管資源
    other.data = nullptr; // 原對象放棄資源
}

2.5 友元

允許外部函數(shù)或類訪問當(dāng)前類的 private/protected 成員(突破封裝,慎用)。

運(yùn)算符重載(如 operator<< 需要訪問對象內(nèi)部數(shù)據(jù))

class Matrix {
private:
    double data[4][4];
public:
    // 友元函數(shù)
    friend Matrix operator*(const Matrix& a, const Matrix& b);
    // 友元類
    friend class MatrixTransformer;
    // 友元成員函數(shù)
    friend void Vector::transform(const Matrix& m);
};
// 友元函數(shù)實(shí)現(xiàn)
Matrix operator*(const Matrix& a, const Matrix& b) {
    Matrix result;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            result.data[i][j] = 0;
            for (int k = 0; k < 4; k++) {
                result.data[i][j] += a.data[i][k] * b.data[k][j];
            }
        }
    }
    return result;
}

2.6 多重繼承和菱形繼承

當(dāng)一個(gè)類間接繼承自同一個(gè)基類兩次時(shí),會導(dǎo)致基類成員重復(fù)存儲(二義性)。

多重繼承

class A { public: int x; };
class B : public A {};
class C : public A {};
class D : public B, public C {}; 
int main() {
    D d;
    // d.x = 10; // 錯(cuò)誤:二義性(B::x 還是 C::x?)
    return 0;
}

使用 虛繼承(virtual inheritance),確保基類在派生類中只存在一份實(shí)例。

class A { public: int x; };
class B : virtual public A {}; // 虛繼承 A
class C : virtual public A {}; // 虛繼承 A
class D : public B, public C {}; 
int main() {
    D d;
    d.x = 10; // 正確:A 只存在一份
    return 0;
}

3、現(xiàn)代 C++ 中的面向?qū)ο筇匦?/h2>

3.1 override 和 final關(guān)鍵字

class Base {
public:
    virtual void func() const;
    virtual void finalFunc() final; // 禁止重寫
};
class Derived : public Base {
public:
    void func() const override; // 顯式重寫
    // void finalFunc(); // 錯(cuò)誤:不能重寫final函數(shù)
};
class FinalClass final : public Base { // 禁止繼承
    // ...
};

3.2 智能指針

class Base {
public:
    virtual void process() = 0;
    virtual ~Base() = default;
};
class Derived : public Base {
public:
    void process() override {
        std::cout << "Processing in Derived" << std::endl;
    }
};
// 使用智能指針管理多態(tài)對象
std::unique_ptr<Base> createObject() {
    return std::make_unique<Derived>();
}
void processObjects(const std::vector<std::unique_ptr<Base>>& objects) {
    for (const auto& obj : objects) {
        obj->process();
    }
}

4、面向?qū)ο笤O(shè)計(jì)原則 (SOLID)

4.1 單一職責(zé)原則 (Single Responsibility)

一個(gè)類應(yīng)該只有一個(gè)引起變化的原因。

// 違反單一職責(zé)
class Report {
public:
    void generateContent() { /* 生成內(nèi)容 */ }
    void saveToFile() { /* 保存到文件 */ }
    void print() { /* 打印 */ }
    void sendByEmail() { /* 發(fā)送郵件 */ }
};
// 遵循單一職責(zé)
class ReportContent {
public:
    void generate() { /* 生成內(nèi)容 */ }
};
class ReportSaver {
public:
    void saveToFile(const ReportContent& content) { /* 保存到文件 */ }
};
class ReportPrinter {
public:
    void print(const ReportContent& content) { /* 打印 */ }
};
class ReportEmailSender {
public:
    void sendByEmail(const ReportContent& content) { /* 發(fā)送郵件 */ }
};

4.2 開閉原則 (Open-Closed)

對擴(kuò)展開放,對修改關(guān)閉。

// 違反開閉原則
class AreaCalculator {
public:
    double calculateArea(const std::string& shapeType, double param1, double param2 = 0) {
        if (shapeType == "circle") {
            return 3.14 * param1 * param1;
        } else if (shapeType == "rectangle") {
            return param1 * param2;
        }
        // 添加新形狀需要修改這個(gè)函數(shù)
        return 0;
    }
};
// 遵循開閉原則
class Shape {
public:
    virtual double area() const = 0;
    virtual ~Shape() = default;
};
class Circle : public Shape {
private:
    double radius;
public:
    Circle(double r) : radius(r) {}
    double area() const override { return 3.14 * radius * radius; }
};
class Rectangle : public Shape {
private:
    double width, height;
public:
    Rectangle(double w, double h) : width(w), height(h) {}
    double area() const override { return width * height; }
};
class AreaCalculator {
public:
    double calculateArea(const Shape& shape) {
        return shape.area(); // 添加新形狀不需要修改這個(gè)函數(shù)
    }
};

4.3 里氏替換原則 (Liskov Substitution)

派生類必須能夠替換其基類。

// 違反里氏替換原則
class Rectangle {
protected:
    double width, height;
public:
    virtual void setWidth(double w) { width = w; }
    virtual void setHeight(double h) { height = h; }
    double area() const { return width * height; }
};
class Square : public Rectangle {
public:
    void setWidth(double w) override {
        width = height = w; // 改變了父類的行為
    }
    void setHeight(double h) override {
        width = height = h; // 改變了父類的行為
    }
};
// 使用
void testRectangle(Rectangle& rect) {
    rect.setWidth(5);
    rect.setHeight(4);
    assert(rect.area() == 20); // 對于Square會失敗
}

4.4 接口隔離原則 (Interface Segregation)

客戶端不應(yīng)該被迫依賴它們不使用的接口。

// 違反接口隔離
class Worker {
public:
    virtual void work() = 0;
    virtual void eat() = 0;
    virtual void sleep() = 0;
};
class Robot : public Worker {
public:
    void work() override { /* 工作 */ }
    void eat() override { /* 機(jī)器人不需要吃飯 */ }
    void sleep() override { /* 機(jī)器人不需要睡覺 */ }
};
// 遵循接口隔離
class Workable {
public:
    virtual void work() = 0;
};
class Eatable {
public:
    virtual void eat() = 0;
};
class Sleepable {
public:
    virtual void sleep() = 0;
};
class Human : public Workable, public Eatable, public Sleepable {
    // 實(shí)現(xiàn)所有接口
};
class Robot : public Workable {
    // 只實(shí)現(xiàn)需要的接口
};

4.5 依賴倒置原則 (Dependency Inversion)

高層模塊不應(yīng)該依賴低層模塊,兩者都應(yīng)該依賴抽象。

// 違反依賴倒置
class MySQLDatabase {
public:
    void saveData(const std::string& data) {
        // MySQL特定的保存邏輯
    }
};
class Application {
private:
    MySQLDatabase database; // 直接依賴具體實(shí)現(xiàn)
public:
    void process() {
        // 處理數(shù)據(jù)
        database.saveData("processed data");
    }
};
// 遵循依賴倒置
class Database {
public:
    virtual void saveData(const std::string& data) = 0;
    virtual ~Database() = default;
};
class MySQLDatabase : public Database {
public:
    void saveData(const std::string& data) override {
        // MySQL特定的保存邏輯
    }
};
class Application {
private:
    Database& database; // 依賴抽象
public:
    Application(Database& db) : database(db) {}
    void process() {
        // 處理數(shù)據(jù)
        database.saveData("processed data");
    }
};

5、常見問題

構(gòu)造函數(shù)為什么不能是虛函數(shù)?

構(gòu)造函數(shù):虛函數(shù)依賴vtable,而vtable在構(gòu)造函數(shù)中初始化,形成循環(huán)依賴

如何選擇繼承與組合?

使用繼承:is-a關(guān)系,需要多態(tài)行為

使用組合:has-a關(guān)系,代碼復(fù)用無需多態(tài)

優(yōu)先選擇組合:更靈活,降低耦合度

組合的最佳實(shí)踐

依賴倒置原則

// 高層模塊依賴抽象
class ReportGenerator {
private:
    IDataProvider& provider; // 依賴接口
public:
    ReportGenerator(IDataProvider& prov) : provider(prov) {}
    void generate() {
        auto data = provider.getData();
        // 生成報(bào)告
    }
};
// 低層模塊實(shí)現(xiàn)接口
class DatabaseProvider : public IDataProvider { /* ... */ };
class APIDataProvider : public IDataProvider { /* ... */ };

使用智能指針管理

class NetworkConnection { /* ... */ };
class ChatClient {
private:
    std::unique_ptr<NetworkConnection> connection;
public:
    void connect() {
        connection = std::make_unique<NetworkConnection>();
        // ...
    }
    void disconnect() {
        connection.reset(); // 顯式釋放
    }
};

接口隔離

// 細(xì)粒度接口
class IReader {
public:
    virtual std::string read() = 0;
};
class IWriter {
public:
    virtual void write(const std::string&) = 0;
};
class FileHandler : public IReader, public IWriter { /* ... */ };
class Logger {
private:
    IWriter& writer; // 只需要寫功能
public:
    Logger(IWriter& w) : writer(w) {}
};

移動語義如何影響面向?qū)ο笤O(shè)計(jì)?

移動語義允許更高效的對象傳遞和返回,使得可以設(shè)計(jì)更復(fù)雜的對象層次結(jié)構(gòu)而不用擔(dān)心性能問題。

什么時(shí)候應(yīng)該使用私有繼承?

當(dāng)你想表達(dá)"實(shí)現(xiàn)為"關(guān)系而不是"是一個(gè)"關(guān)系時(shí),或者當(dāng)你需要重寫虛函數(shù)但不想暴露基類接口時(shí)。

深拷貝與淺拷貝的區(qū)別?如何實(shí)現(xiàn)深拷貝?

淺拷貝:僅復(fù)制對象的成員變量值(如指針地址),新舊對象共享同一塊內(nèi)存(可能導(dǎo)致 “double free” 或一方修改影響另一方)。

深拷貝:為新對象分配獨(dú)立內(nèi)存,復(fù)制原對象數(shù)據(jù)內(nèi)容,新舊對象互不影響。

實(shí)現(xiàn):手動定義拷貝構(gòu)造函數(shù)和賦值運(yùn)算符重載,為指針成員分配新內(nèi)存并復(fù)制數(shù)據(jù)。

class MyString {
private:
    char* str;
public:
    // 深拷貝構(gòu)造
    MyString(const MyString& other) {
        str = new char[strlen(other.str) + 1];
        strcpy(str, other.str);
    }
    // 深拷貝賦值
    MyString& operator=(const MyString& other) {
        if (this != &other) { // 避免自賦值
            delete[] str; // 釋放舊內(nèi)存
            str = new char[strlen(other.str) + 1];
            strcpy(str, other.str);
        }
        return *this;
    }
    ~MyString() { delete[] str; }
};

this 指針的特性?能否在靜態(tài)成員函數(shù)中使用 this 指針?

特性:

  • this 是隱含在非靜態(tài)成員函數(shù)中的常量指針(T* const),指向當(dāng)前對象。
  • 只能在非靜態(tài)成員函數(shù)中使用,不能在全局函數(shù)、靜態(tài)成員函數(shù)中使用。
  • 不能被賦值(this = &obj 錯(cuò)誤)。
  • 靜態(tài)成員函數(shù)中不能使用 this 指針:因?yàn)殪o態(tài)成員函數(shù)屬于類而非對象,沒有具體的實(shí)例對象,因此不存在 this 指針。

到此這篇關(guān)于C++ 面向?qū)ο蟮奈恼戮徒榻B到這了,更多相關(guān)C++ 面向?qū)ο髢?nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 使用Npcap庫開發(fā)簡單的掃描功能

    使用Npcap庫開發(fā)簡單的掃描功能

    nmap(Network?Mapper)是一款開源免費(fèi)的針對大型網(wǎng)絡(luò)的端口掃描工具,nmap可以檢測目標(biāo)主機(jī)是否在線、主機(jī)端口開放情況、檢測主機(jī)運(yùn)行的服務(wù)類型及版本信息、檢測操作系統(tǒng)與設(shè)備類型等信息,本文主要介紹nmap工具安裝和基本使用方法,
    2024-08-08
  • Redis和Memcache對比與如何選擇

    Redis和Memcache對比與如何選擇

    我這段時(shí)間在用redis,感覺挺方便的,但比較疑惑在選擇內(nèi)存數(shù)據(jù)庫的時(shí)候到底什么時(shí)候選擇redis,什么時(shí)候選擇memcache,然后就查到下面對應(yīng)的資料,是來自redis作者的說法(stackoverflow上面)
    2020-07-07
  • 為IBM x3650 M2 服務(wù)器配置RAID卡圖文教程

    為IBM x3650 M2 服務(wù)器配置RAID卡圖文教程

    正好今天公司一臺IBM服務(wù)器上運(yùn)行的應(yīng)用業(yè)務(wù)遷移走了有機(jī)會可以做一些測試,于是想嘗試這寫幾篇關(guān)于IBM 3650M2服務(wù)器配置RAID和IMM卡的總結(jié)和大家分享吧
    2018-05-05
  • 多核心服務(wù)器和高主頻服務(wù)器怎么選?cpu主頻高和核心多哪個(gè)更好?

    多核心服務(wù)器和高主頻服務(wù)器怎么選?cpu主頻高和核心多哪個(gè)更好?

    這篇文章主要介紹了多核心服務(wù)器和高主頻服務(wù)器怎么選?cpu主頻高和核心多哪個(gè)更好?,需要的朋友可以參考下
    2023-07-07
  • 最新評論