Download presentation
Presentation is loading. Please wait.
Published byRalf Harper Modified over 8 years ago
1
NESTED CLASS
2
Apa itu nested class ? Nested class is a class defined inside a class, that can be used within the scope of the class in which it is defined. In C++ nested classes are not given importance because of the strong and flexible usage of inheritance. Its objects are accessed using "Nest::Display". (sumber: http://hscripts.com/tutorials/cpp/nested-classes.php)
3
Contoh Nested Class C++ class Nest { public: class Display { private: int s; public: void sum( int a, int b) { s =a+b; } void show( ) { cout << "\nSum of a and b is:: " << s;} }; void main() { Nest::Display x; x.sum(12, 10); x.show(); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.