Arrays with different datatypes i.e. strings and integers. (Objectorientend)

后端 未结 5 1682
谎友^
谎友^ 2020-12-24 15:29

For example I have 3 books: Booknumber (int), Booktitle (string), Booklanguage (string), Bookprice (int).

Now, I

5条回答
  •  无人及你
    2020-12-24 16:23

    Why not create a class Book with properties: Number, Title, and Price. Then store them in a single dimensional array? That way instead of calling

    Book[i][j] 
    

    ..to get your books title, call

    Book[i].Title
    

    Seems to me like it would be a bit more manageable and code friendly.

提交回复
热议问题