求解一题C++ OOP题目 急!!
各位大虾好 小弟刚开始接触OOP 想请问一道题目, 如下用以下数据写一个名为Room的类程序
Room
name : string
num : int)
Room(void)
Room(int, string)
int getNum():int
void setNum(int)
getRoomDetails():string
(a) Write the class specification for Room.
(b) Implement the constructors and method you have specified in (a).
Additional information:
The default values for num and name in Room constructor are 0 and “Default Room Name” respectively.
The method getRoomDetails concatenates the values in num and name and return it as a string.
(c) Write a test program to test the constructor and methods in Room class. Create two instances of Room using the following data,
First Instance:
Use the default values
Second Instance:
num = 12
name = “JungleBytes Room”
最终运行程序时显示如下内容:
Room Number for default values:0
Room Number with given values:12
Room Details for room with default values:0, Default Room Name
Room Details for room with given values:12, JungleBytes Room