/*
* Copyright ©2026 Soham Pardeshi. All rights reserved.
* Permission is hereby granted to students registered for University of
* Washington CSE 333 for use solely during Summer Quarter 2026 for
* purposes of the course. No other use, copying, distribution, or
* modification is permitted without prior written consent. Copyrights
* for third-party components of this work must be honored. Instructors
* interested in reusing these course materials should contact the author.
*/
#ifndef ASSET_H_
#define ASSET_H_
#include <string>
namespace cse333 {
// An abstract base class for things you can own in a portfolio.
//
// GetMarketValue() is a PURE virtual function (`= 0`, slide 25), so Asset
// is abstract: you cannot instantiate an Asset directly, only a concrete
// subclass such as Stock or Cash.
//
// The destructor is virtual (slide 28) so that deleting a derived object
// through an `Asset*` runs the derived destructor too, avoiding leaks.
class Asset {
public:
explicit Asset(const std::string& name) : name_(name) {}
virtual ~Asset() {}
// Pure virtual: every concrete asset must say what it is worth.
virtual double GetMarketValue() const = 0;
const std::string& name() const { return name_; }
private:
std::string name_;
};
} // namespace cse333
#endif // ASSET_H_