Week 8: Initializing Objects with Constructors,Defining member functions outside of the class
-
Constructors are a special kind of methods that are invoked to perform initializing actions.
-
A constructor with no parameters is referred to as a no-arg constructor.
•Constructors must have the same name as the class itself.
•Constructors do not have a return type—not even void.
•Constructors are invoked using the new operator when an object is created. Constructors play the role of initializing objects.
Course Material
- Week 1: Introduction to the Course
- Week 2: Functions
- Week 3: Inline Functions (Local and Global variables,static variables )
- Week 4: Overview of Java, Why should I use Java? and create Simple Program
- Week 5: Basic Syntax Of Java,Java Identifiers,Java Variables,Java Modifiers,Java Enums,,Java Basic Data Types:
- Week 6: Introduction to Classes
- Week 7: Initializing Objects and Classes
- Week 8: Initializing Objects with Constructors,Defining member functions outside of the class
- Week 9: Accessing Instance Variables and Methods, Garbage Collection,The Date Class, The Random Class
- Week 10: Constructor Overloading, Passing object to member function, returning object from member function
- Week 11: Static Data Member, Const used with functions and Arguments
- Week 12: Inheritance, Polymorphism, Encapsulation, Abstraction
- Week 13: Streams And Files
- Week 14: Templates and Exception Handling
- Chapters 14
- Department CS & IT(SCB)
- Teacher
Mr. Aamir Shehzad