Skip to main content

Posts

Showing posts from April, 2024

lecture second

method overloading  1.  return type should be same 2.  can't create two functions with same parameters in class class A f void add (int a, int b); void add (int a, string b, int c); A obj =new A();  access modifier 1.public ( access in all area) 2. private (only access in class)    final keyword-avoid inheritance encapsulation In class method and variables in a single unit note; 1. declare the class variables in private 2. declare the class methods in public example  private int a; public set (int a) this a=a