answersLogoWhite

0


Best Answer

Attributes are the class member variables, the data, fields or other properties that define the class state. Methods are the functions of a class, the operations that define its behaviour, typically working in conjunction with the class member attributes to either alter the class state (mutators) or query the class state (accessors). Special methods such as the class constructors, its destructor and conversion operators are invoked indirectly through compiler-generated code while all others are called directly via programmer-generated code.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are attributes and methods in class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What Grouping objects along with their attributes and methods into a class is called?

Composition.


Why inherit function is not called?

Inherit is not a function. It is a class derivation where some of the methods and attributes of the new class inherit from a parent class.


What is meant by inheritance in c plus plus language?

Inheritance in C++ and in other Object Oriented languages is the creation of a class that incorporates a different class. The child (or derived) class "inherits" all of the elements (attributes and methods) of the parent (or base) class. Depending on the design of the base class, the derived class can use methods and attributes of the base class as if they were its own. Typically, however, attributes of the base class are private to the base class and inaccessible to the derived class so as to maintain class hierarchy and data encapsulation.


How can a base class protect derived classes so that changes to the base class will not affect them explain with example?

In order for a base class to protect derived classes, so that changes to the base class do not affect the derived classes, you must make sure that the public interface exposed by the base class does not change when the implementation of those public methods do change. You can also prevent inadvertant access to the base class attributes from the derived class, by making them private. class base { public: base(...) {...}; /* constructor */ base~(...) {...}; /* destructor */ method(...) {...}; /* other public methods */ private: ... etc. } class child : base { public: ... private: ... } So long as the calling sequence and functionality (interface) of the base class public methods do not change, the implementation of those public methods can change, and the private methods and attributes can change, without impacting any child class.


When you define a c plus plus class what items are considered part of the interface?

The interface of a C++ class is the public methods and attributes that are exposed by the class. In a pure abstract base class, the interface is enforced by the compiler in each of the derived child classes.


What are apex classes?

Apex is a strongly typed, object-oriented programming language. A class is a template or blueprint from which objects are created. An Apex Class is a library of attributes and methods and serves as a blueprint to create Apex objects.


Can you have inheritance without polymorphism?

Yes. Inheritance and polymorphism are two different things. Inheritance is when the attributes and methods of a class are inherited by a deriving class that creates a more specialized type. Polymorphism is when two methods exist with the same name, differing only in argument types, or in class type. The former type, argument types, is an example of ad-hoc polymorphism that does not even require a class.


What is exteranalizable in java?

Externalizable interface is a subclass of Serializable. Java provides Externalizable interface so as to give you more control over what is being serialized and what is not. Using this interface, you can Serialize only the fields of the class you want serialize and ignore the rest. This interface defines 2 methods: readExternal() and writeExternal() and you have to implement these methods in the class that will be serialized. In these methods you'll have to write code that reads/writes only the values of the attributes you are interested in. Programs that perform serialization and deserialization have to write and read these attributes in the same sequence


Can instance methods replace class methods in programming?

No. never. An instance method cannot replace a class method because: Instance Methods - are normal methods that are linked to a class object instance Class Methods - are static methods that are not linked to any class object. These methods are not interchangeable and will create too many issues if we try to use one in place of the other.


When are class methods appropriate?

Static methods or class methods are usually used when you want functionality to be executed without creating an instance of the class where that piece of code resides.


How do you Design a java class to represent a bank account that includes the following data members owner nameAcc no and balance amount and method membersassign initial valuesdeposit Balance?

design a class library that works on library system that include the following attributes and methods


How do you access java attributes class?

through the imporrt