摘要:
class MatrixBase{ int rows, cols;public: MatrixBase(int the_rows, int the_cols) :rows(the_rows), cols(the_cols){} int GetRows()const { return rows; } 阅读全文
摘要:
class MyClass{ int value;public: MyClass(int i=10) { value = i; cout << "Constructor called." << endl; } MyClass( MyClass& p) { p.value = 11; value = 阅读全文
摘要:
class Room{ int room_no; double length; double width;public: Room(int the_room_no, double the_length, double the_width) :room_no(the_room_no), length( 阅读全文
摘要:
class book{ char* title; int num_pages; int cur_page;public: book(const char* theTitle, int pages) :num_pages(pages) { title = new char[strlen(theTitl 阅读全文
摘要:
class shape{public: virtual float perimeter() const{ return 0; } virtual float area()const { return 0; } virtual const char* name()const { return "抽象图 阅读全文
摘要:
class MyClass{ int member;public: MyClass(int x) :member(x){} //析构函数必须有“void”参数列表 ~MyClass(){} //需要访问类的成员变量时需要用友元函数 friend void judge(MyClass &obj);}; 阅读全文
摘要:
class book{ char* title;//书名 int num_pages;//页数 char * writer;//作者姓名public: book( char* the_title, int pages, const char* the_writer) :num_pages(pages 阅读全文
摘要:
#include "stdafx.h"#include "iostream"#include <ctime>using namespace std;//全局常量size=4const int size=4;template <typename T>class MyClass{public: MyCl 阅读全文
摘要:
#include "stdafx.h"#include "iostream"#include <ctime>using namespace std;//getNum()获得数字字符串函数char * getNum(char *src, char *buf){ while (* src!='\0') 阅读全文
摘要:
#include "stdafx.h"#include "iostream" using namespace std; class MyClass{ int _i; friend void Increment(MyClass& f);public: const int NUM; //常量值的定义:N 阅读全文