![]() |
CITS2002 Systems Programming |
← prev | next → | ![]() |
![]() |
|||
Classes and internal methodsAs with other object-oriented languages, C++ 'collects' strongly related data and functions operating on that data in classes.C++ classes may legally have only data members (fields), with no internal methods, and they are then very similar to C11's structures.
In this example,
the class MyVector has two public methods
that have access to the class's data members.
Note that the methods offset() and print() are internal to the class definition and, thus, act as both declarations and definitions of the methods.
CITS2002 Systems Programming, Lecture 23, p5, 17th October 2023.
|