Methods with classname as a return type

前端 未结 2 874
鱼传尺愫
鱼传尺愫 2021-01-29 03:35

I\'m new in c# or any type of programming language. When I see codes in c# I found there are lot of confusions are over here. one of them I want to clarify from here. Methods co

2条回答
  •  梦如初夏
    2021-01-29 04:26

    In GetStockData method return type would be StockData i.e. you will have to return an instance of StockData class or any sub-class inherited from StockData. It depends on your code whether you create that instance in the GetStockData method or get from some other method, but surely type of the instance should be StockData or any sub-class inherited from StockData class.

提交回复
热议问题