ae cho mình hỏi
void *currensort(float a[], int n);
với
void (*currensort)(float a[], int n);
có khác nhau ko ạ. sao khi mình bỏ dấu ngoặc thì báo lỗi ạ.
#include "sortalgorithm.h"
#include<iostream>
using namespace std;
sortalgorithm*sortalgorithm::_algorithm=NULL;
sortalgorithm::sortalgorithm()
{
currentsort=insertsort; // error
}
void *sortalgorithm::currentsort(int *, int)
Error: expression must be a modifiable lvalue
#pragma once
#include<iostream>
using namespace std;
class sotralgorithm
{
private:
static sortalgorithm * _algorithm;
void *currentsort(int[], int);
sortalgorithm();
public:
static sortalgorithm* getobject(void *temp(int[], int));
static void selectionsort(int[], int);
static void insertsort(int[], int);
static void interchangesort(int[], int);
void sort(int[], int);
};
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?