In case this helps anyone, I solved my problem by correcting the code as follows.
classdef animals < handle
properties
DOG = dog % An instance of the DOG class
CAT = cat % An instance of the CAT class
end
methods
function obj = animals(Dog,Cat)
if nargin==2
obj.DOG = Dog(); % Create an instance of Dog
obj.CAT = Cat(); % Create an instance of Cat
end
end
end
end
If this is bad coding practice, I welcome any advice, but this is what I have gotten to work for me for now. Thanks!