Tutor profile: Rajat S.
Subject: Java Programming
What is an abstract class? How abstract classes are similar or different in Java from C++?
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods. Like C++, in Java, an instance of an abstract class cannot be created, we can have references of abstract class type though. Like C++, an abstract class can contain constructors in Java. And a constructor of abstract class is called when an instance of a inherited class is created In Java, we can have an abstract class without any abstract method. This allows us to create classes that cannot be instantiated, but can only be inherited. Abstract classes can also have final methods (methods that cannot be overridden). For example, the following program compiles and runs fine.
What is a Trigger?
A Trigger is a code that associated with insert, update or delete operations. The code is executed automatically whenever the associated query is executed on a table. Triggers can be useful to maintain integrity in database.
Subject: C++ Programming
What are virtual functions
Virtual functions are used with inheritance, they are called according to the type of object pointed or referred, not according to the type of pointer or reference. In other words, virtual functions are resolved late, at runtime. Virtual keyword is used to make a function virtual. Following things are necessary to write a C++ program with runtime polymorphism (use of virtual functions) 1) A base class and a derived class. 2) A function with same name in base class and derived class. 3) A pointer or reference of base class type pointing or referring to an object of derived class.
needs and Rajat will reply soon.