class - How are classes not objects in C++? -
i reading "design patterns: elements of reusable object-oriented software", (specifically chapter prototype design pattern) , stated that...
"prototype particularly useful static languages c++ classes not objects, , little or no type information available @ run-time." (pg 121)
(emphasis mine)
i had thought classes synonymous objects, , i'm confused statement means. how classes not objects, , why matter if language static?
in c++, declares class:
class { public: int a; };
whereas declares object:
a a;
one cannot interrogate class run-time, 1 can interrogate object. makes sense say, "object 'a', address? please invoke operator+
. etc." in c++, static typing, makes no sense say, "class a, list of members? please add new member, "b"."
in other languages (python comes mind), 1 can manipulate classes in way, because each class object. in addition serving template objects, class itself object -- can printed, modified, etc.
Comments
Post a Comment