Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C++
Class 204 codes
Home
C++
Class
1 A base class reference is used to access a virtual function
2 A base pointer to access derived objects
3 A copy constructor to allow StringClass objects to be passed to functions
4 A generic safe-array class that prevents array boundary errors
5 A simple class with member variable, constructor, destructor
6 A simple conversion function example
7 A simple example of inheritance
8 Abstract base class
9 Abstract classes by virtual function with no body
10 Access control under inheritance
11 Accessing static members using non-static member functions
12 Accessing static members without an object
13 Add method to struct
14 Address class
15 An anonymous union is a union that has neither a tag name nor any objects specified in its declaration
16 An example that uses typeid on a polymorphic class hierarchy
17 An Example with Two Generic Data Types
18 Anonymous union
19 Applying Template Classes
20 Assign object1 to object2
21 Assign the public object member address to a pointer
22 Assign values using the member initialization syntax
23 Automatic inline
24 Base class and derived class
25 Calculate salary using static members
26 Call constructor from base class
27 Call constructor from parent for three level extending
28 Call contructor from parent class
29 Call parent constructor and pass in parameter
30 Call parent constructors in multiple inheritance
31 Call parent virtual function
32 Call virtual function through object pointer
33 Cascade constructor and destructor call
34 Change the object pointer behaviour
35 Class array and object method call
36 Class combination
37 Class combination with private fields
38 Class forward declaration
39 Class to represent a book
40 Class type-casting
41 Class with only public fields and methods
42 Class with setter and displayer
43 Classes and Structures are Related
44 Construct object in an object array one by one
45 Constructing and Destructing sequence for three level inheritance
46 Constructing and Destructing sequence for two base classes
47 Constructor
48 Constructor and destructor inside a struct
49 Constructor with 2 parameters
50 Constructor with parameter value checking
51 Convert to char in function call
52 Copy constructor
53 Create an abstract class
54 Create an inline function
55 Creating Inline Functions Inside a Class
56 Declare class instance
57 Declare Class instance and use them
58 Declare object pointer
59 Declare the instance variable for a class
60 Define and use the destructor
61 Define constructor outside a class definition
62 Define destrcuctor outside the class definition
63 Define friend function for
64 Demonstrate a very simple safe pointer class
65 Demonstrate inheriting a protected base class
66 Demonstrate pointer to derived class
67 Demonstrate protected members
68 Demonstrate virtual functons
69 Demonstrating that class objects can be assigned to each other using default memberwise copy
70 Demonstrating the class member access operators and -
71 Derived class call its base constructor
72 Derived constructor uses no parameters
73 Directly inherit two base classes
74 Dont need a cast to go up the inheritance hierarchy
75 Dynamic allocation and polymorphism
76 Dynamic_cast between base class and derived class
77 Enum field
78 Explicit Class Specializations for generic template class
79 Extending two parent classes
80 Field in struct is public by default
81 Friend class for each other
82 Friend function Demo
83 Friends can access private members of a class
84 Generic Classes
85 Generic stack template class
86 Get storage off stack for array
87 GetName member function reads from the name member variable and the setName member function writes to it
88 How the this class pointer works
89 How to pass arguments to the base classes of a derived class by modifying the preceding program
90 Illustrates the use of a public variable
91 Illustration of the Use of Virtual Inheritance
92 Implement a destructor
93 Implementing Pure Virtual Functions
94 Inheriance for protected member
95 Inherit base as private
96 Inherit base as protected
97 Inherit two base classes
98 Inherit two classes
99 Init member variables from base class
100 Init Object array
101 Inline function that calculates the volume of a sphere
102 Inline functions may be class member functions
103 Interface for subclass
104 Keep the private on your own
105 Loop through an object array and call its method
106 Make field public during private inheritance
107 Make the inserter into a friend function
108 Multiple Virtual Functions Called in Turn
109 Need reinterpret cast to perform pointer conversion from unrelated classes
110 Need reinterpret cast to perform reference conversion from unrelated classes -- static_cast doesnt work
111 Need reinterpret_cast to go from pointer to int and from int to pointer
112 Object array
113 Overloading class constructors
114 Override non-virtual function
115 Parameterized Constructors
116 Pass arguments to base class
117 Passing by reference and using virtual functions in exceptions
118 Pointers to base class
119 Polymorphism with base class pointer
120 Private and protected member variables
121 Private and public sections
122 Private and public variables and methods
123 Protected inheritance
124 Public class extending
125 Public data field
126 Public inheritance
127 Public inheritance from three parent classes
128 Pure Virtual Functions as a prototype
129 Pure virtual members can be called from the abstract base class
130 Reference static method along with class name
131 Replacing typeid with dynamic_cast
132 Sequence template
133 Setting member access levels
134 Share member variables between sub class
135 Simple class with its derived class
136 Simplest class definition
137 Stack class using a structure
138 Static counter
139 Static field is shared among instances
140 Static functions and ID numbers for objects
141 Static member data
142 Static member functions
143 Static member variables and functions
144 Static members in classes
145 String type constructor
146 System will call the destructor
147 Template class with generic parameter
148 Template class with two generic parameters
149 Template class with type parameter
150 Template extending
151 Template Version of Generic binary sorted Tree
152 The const_cast operator is used to explicitly override const andor volatile in a cast
153 The dynamic_cast performs a run-time cast that verifies the validity of a cast
154 The Member Initialization Syntax
155 The reinterpret_cast operator converts one type into a fundamentally different type
156 The static_cast operator performs a nonpolymorphic cast
157 The Virtual Attribute Is Inherited
158 This points yourself
159 Three level public inheriance
160 Unions and Classes are Related
161 Update static field in member method
162 Use & to get object address
163 Use automatic conversions to assign new values
164 Use Base keyword to call method in parent class from subclass
165 Use class name to reference field name
166 Use const_cast on a const reference
167 Use constructor to init member variables
168 Use Double value as the constructor parameter
169 Use dynamic_cast to convert object pointer to its subclass
170 Use friend function to access the non-public member variable
171 Use inline to make this program more efficient
172 Use object pointer to reference virtual method
173 Use public methods to access private fields
174 Use struct to initialize a class
175 Use union to define class
176 Use virtual function to define interface
177 Use virtual functions and polymorphism
178 Using a class instead of struct
179 Using a constructor and destructor
180 Using a static data member in a class
181 Using a structure to define a class
182 Using an array of class objects
183 Using base pointers on DerivedClass class objects
184 Using Default Arguments with Template Classes
185 Using exceptions with templates
186 Using Non-Type Arguments with Generic Classes
187 Using pointers on derived class objects
188 Using the this pointer to refer to object members
189 Using Virtual Functions to control the behaviour
190 Using Virtual Methods
191 Virtual base classes
192 Virtual Copy Constructor
193 Virtual function and two subclasses
194 Virtual function from base and derived classes
195 Virtual function in three level inheritance
196 Virtual functions
197 Virtual functions accessed from pointer
198 Virtual Functions and Polymorphism
199 Virtual Functions Are Hierarchical
200 Virtual functions retain virtual nature when inherited
201 Virtual functions with person class
202 Virtual members
203 Virtual public inheritance
204 You may change access specifications as often as you like within a class declaration