亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
請問哪里能下載到老師的源代碼
我想問一下老師說的那句:對象作為數據成員的情況中,構造函數都沒有參數是什么意思?
有指針指向類,是不是也有類的引用
源碼在VS2017中運行不了
走迷宮bfs呀
Array.h:
#pragma once
#include"iostream"
#include"stdlib.h"
using namespace std;
class Array {
public:
Array() {};
~Array() {};
Array(const Array & arr);
void set_Arrary(int count);
int get_Arrary();
private:
int m_iCount;
};
Array.cpp:
#include"array.h"
void Array::set_Arrary(int count) {
m_iCount = count;
}
int Array::get_Arrary() {
return m_iCount;
}
Array::Array(const Array & arr) {
m_iCount = arr.m_iCount;
}
源:
#include"array.h"
int main() {
Array arr1;
arr1.set_Arrary(6);
Array arr2(arr1);
cout << arr2.get_Arrary();//實現部分
return 0;
}
B:
int main(void) {
Coordinate coorArr[2];
coorArr[0].m_iX = 1;
coorArr[0].m_iY = 2;
coorArr[1].m_iX = 3;
coorArr[1].m_iY = 4;
for (int i = 0; i < 2; i++) {
coorArr[i].printInfo();
}
return 0;
}
應付測試的版本:
A:
#include <iostream>
using namespace std;
class Coordinate {
public:
Coordinate() {};
void printInfo();
public:
int m_iX;
int m_iY;
};
void Coordinate::printInfo() {
cout << "(" << m_iX << "," << m_iY << ")" << endl;
}
B:
line::line(int x1, int y1, int x2, int y2) :m_coorA(x1, y1), m_coorB(x2, y2) {}
void main() {
line *p = new line(1, 2, 3, 4);
delete[]p;

}
A:
#include"iostream"
using namespace std;
class Coordinate {
public:
Coordinate(int x, int y) {};
private:
int m_ix;
int m_iy;
};
class line {
public:
line(int x1, int y1, int x2, int y2);
private:
Coordinate m_coorA;
Coordinate m_coorB;
};
B:
//遍歷輸出
for (int i = 0; i < 3; i++) {
cout << "coord_x :" << "\t" << coord[i].m_ix << endl;
cout << "coord_y :" << "\t" << coord[i].m_iy << endl;
}
for (int i = 0; i < 3; i++) {
cout << "p_x:" << "\t" << p->m_ix << endl;
cout << "p_y:" << "\t" << p->m_iy << endl;
p--;
}
delete[]p;
A:
#include"iostream"
using namespace std;
int main() {
class Coordinate {
public:
int m_ix;
int m_iy;
}coord[3] = { 3,5,2,6,3,7 };
Coordinate *p = new Coordinate[3];
//p0
p[0].m_ix = 20;
p->m_iy = 20;
p++;
//p1
p->m_ix = 6;
p[0].m_iy = 7;
//p2
p[1].m_iy = 9;
p++;
p->m_ix = 8;
課程須知
本課程是C++初級課程 需要掌握C++語言基礎語法 如果不太熟悉的話,可以觀看: 《C++遠征之起航篇》 《C++遠征之離港篇》 《C++遠征之封裝篇(上)》
老師告訴你能學到什么?
1、對象數組的定義和使用 2、對象成員的定義和使用 3、深拷貝和淺拷貝 4、對象指針、對象引用的定義和使用 5、常對象指針、常對象引用、常成員函數的定義和使用

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!

本次提問將花費2個積分

你的積分不足,無法發表

為什么扣積分?

本次提問將花費2個積分

繼續發表請點擊 "確定"

為什么扣積分?

舉報

0/150
提交
取消